You are on page 1of 20

Single-cell array formula examples

Note: All of the names in this workbook are sheet-level names.


Summing a range that contains error values

Total Number Per Unit


80 10 8.00
120 6 20.00
144 12 12.00
#DIV/0!
#DIV/0!
100 20 5.00
50 5 10.00
TOTAL: #DIV/0!

55.000 <-- SUM, excluding errors

55.000 <-- Excel 2007 only


Counting error values in a range

0 12 #DIV/0! #N/A
1 13 13 #NAME?
2 14 7 2
3 15 5 3
4 16 4 4
5 17 3.4 5
6 18 3 6
7 19 2.714286 7
8 20 2.5 8
9 21 Err:502 9
10 22 2.2 10
11 23 2.090909 11

4 <-- Number of error values


Conditional summing

-3 15 <-- Sum greater than 0 AND less than or equal to 5


-2 34 <-- Sum less than 0 OR greater than 5
-1 34 <-- Sum less than 0 OR greater than 5 (non-array formula)
0
1 Excel 2007 Only
2 15 <-- Sum greater than 0 AND less than or equal to 5
3
4
5
6
7
8
9
10
Summing the n largest values

5 9 13
15 19 23
15 19 23
17 21 25
19 23 27
20 24 28
22 26 30
24 28 32
35 39 43
37 41 45
43 47 51
100 101 102

Number to sum? 3
Sum: 303
Exclude zero from average

Sales Person Sales


Abner 23,991
Baker 15,092
Charleston 0
Davis 11,893
Ellerman 32,116
Flugelhart 29,089
Gallaway 0
Harrison 33,211

18,174 <-- Average with zeros


24,232 <-- Average without zeros (array formula)

24,232 <-- Average without zeros (non-array formula)


Is a value contained in a range?

Enter a Name --> Curt Found

Al Daniel Harold Lyle Richard


Allen Dave Ian Maggie Rick
Andrew David Jack Margaret Robert
Anthony Dennis James Marilyn Rod
Arthur Don Jan Mark Roger
Barbara Donald Jeff Marvin Ronald
Bernard Doug Jeffrey Mary Russ
Beth Douglas Jerry Matt Sandra
Bill Ed Jim Mel Scott
Bob Edward Joe Merle Simon
Brian Eric John Michael Stacy
Bruce Fran Joseph Michelle Stephen
Cark Frank Kathy Mike Steven
Carl Fred Kathy Norman Stuart
Charles Gary Keith Patrick Susan
Chris George Kenneth Paul Terry
Chuck Glenn Kevin Peter Thomas
Clark Gordon Larry Phillip Timothy
Curt Greg Leonard Ray Vincent
Dan Gregory Louise Rebecca Wendy

Non-array formula: Curt Found


Counting the number of differences between two ranges

MyData YourData
1 34 1 34 0 0 0 0
3 35 3 35 0 0 0 0
5 36 5 36 0 0 0 0
7 37 7 37 0 0 0 0
9 38 9 38 0 0 0 0
11 39 11 39 0 0 0 0
13 40 13 40 0 0 0 0
15 41 14 41 1 0 1 0
17 42 17 42 0 0 0 0
19 43 19 43 0 0 0 0
21 44 21 44 0 0 0 0
23 45 23 43 0 1 0 1
25 46 25 46 0 0 0 0
27 47 27 47 0 0 0 0
29 48 29 48 0 0 0 0
31 49 31 49 0 0 0 0
33 50 33 50 0 0 0 0

Differences found: 2
Alternate version: 2
Location of the maximum value in a range

1 Maximum value: 78
3 Row of maximum value: 15
5 Address of maximum value: $A$15
6
9
12
15
22
32
44
32
55
78
49
41
The row of the nth occurrence of a value

1 Value to find: 1
3 Occurrence of Value: 3
3 It's in row: 18
6
6
6
8
8
3
8
8
8
8
1
1
Longest text in a range

January
February Longest text: September
March
April
May
June
July
August
September
October
November
December
Valid items in a range

Master MyList
AZ-101 AZ-109 All items valid? 0
AZ-102 AZ-105 Invalid items: 2
AZ-103 AZ-109 First invalid item: AZ-121
AZ-104 AZ-107
AZ-105 AZ-121
AZ-106 AZ-122
AZ-107
AZ-108
AZ-109
AZ-110
AZ-111
AZ-112
AZ-113
AZ-114
AZ-115
AZ-116
Sum of the digits of a value

Number Sum of Digits


132 6
9 9
111111 6
980991 36
-980991 36
409 13
0
12 3
123 6
Summing rounded values

Description Quantity Unit Price Discount Total


Widgets 6 $11.69 5.23% $66.47
Sprockets 8 $9.74 5.23% $73.84
Snapholytes 3 $9.85 5.23% $28.00
GRAND TOTAL $168.32 <-- appears to be incorrect

Sum of rounded values: $168.31


Removing non-numeric characters from a cell

AZ434 434
XT656 656
5T 5
T5 5
5T5 5T
Determining the closest value in a range

-12 Target Value: 45


-4 Closest Match: 48
4
12
20
32
40
48
56
72
80
88
96
97
105
137
145
165
173
Returning the last value in a column or row

Data 101 <-- Last non-empty cell in Column A


12 <-- Last non-empty cell in Row 6
5 12
23
43
2

2
2
54

101
Ranking data with an array formula

Salesperson Sales Excel's Rank Ranks With


Function Array Formula
Adams 123,000 6 6
Bigelow 98,000 9 10
Fredericks 98,000 9 10 Assigned middle rank
Georgio 98,000 9 10
Jensen 25,000 12 12
Juarez 101,000 8 8
Klein 305,000 1 1
Lynch 145,000 3 3.5
Mayne 145,000 3 3.5 Assigned average rank
Roberton 121,000 7 7
Slokum 124,000 5 5
Wu 150,000 2 2
Dynamic crosstabulation

Date Category Amount


1/4/2007 Food 23.50 Transp Food Lodging
1/4/2007 Transp 15.00 4-Jan 160.50 49.57 65.95
1/4/2007 Food 9.12 5-Jan 20.00 27.80 89.00
1/4/2007 Food 16.95 6-Jan 0.00 101.96 75.30
1/4/2007 Transp 145.50 7-Jan 11.50 25.00 112.00
1/4/2007 Lodging 65.95
1/5/2007 Transp 20.00
1/5/2007 Food 7.80
1/5/2007 Food 20.00
1/5/2007 Lodging 89.00
1/6/2007 Food 9.00
1/6/2007 Food 3.50
1/6/2007 Food 11.02
1/6/2007 Food 78.44
1/6/2007 Lodging 75.30
1/7/2007 Transp 11.50
1/7/2007 Food 15.50
1/7/2007 Food 9.50
1/7/2007 Lodging 112.00
Sheet19

Summing every nth value

Data
1 5 =nth
2 34 = Result
3
4 30 Alternate method
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

Page 20

You might also like