Array Formulas
Array Formulas
https://www.vertex42.com/blog/excel-formulas/array-formula-examples.html
This workbook contains examples from the article "Excel Array Formula Examples." Regarding copyright and s
think of this file like a book. You may use the ideas and techniques and formulas explained here, but you may
reproduce this worksheet or copy substantial portions from it, just like a book. Thank you. - Jon Wittwer
EXAMPLES
MAX-IF Find the last Date that Bob was Contacted Person
=MAX(IF(contact_range="Bob",date_range)) Jim
Bob
NOTE The FALSE values returned by the IF formula are not treated as 0 values by the LARGE
and SMALL functions. If SMALL treated FALSE values as 0 values, the formula would not
work.
SUM-IF Find the total Sales for Jim and Bob Person
=SUM(IF(contact_range="Bob",sales_range)) Jim
Bob
Values
67
23
#N/A
#NAME?
blank
=""
Office 365! The new SEQUENCE function available in Office 365 makes creating sequential number arrays a
Where applicable, I'll give the Office 365 version of these older formulas.
Formula: =ROW(1:5)
Office 365: =SEQUENCE(5)
Formula: =ROW(INDIRECT(n&":"&m)) n
5
m
7
NOTE The results are showing only the first 3 values of the array. Try making n = m in this
example to see what happens. Also note that when the multi-cell array result is larger than
the array the formula returns, the array is filled with NA() errors.
NOTE In this example, we can't create a multi-cell array formula that changes in size. So, it's only
the first 3 values that are shown. However, you can use a variable length array like this
within other array formulas.
Sequential Powers of 10
Formula: =10^(ROW(OFFSET(INDIRECT("A1"),0,0,n,1))-1)
Formula: =10^(ROW(INDIRECT("1:"&n))-1)
Office 365: Most of these functions no longer require you to use Ctrl+Shift+Enter, because they are dynamic
I= =MUNIT(n)
I= 1 0
0 1
j= =c+0*ROW(INDIRECT("1:"&n))
Office 365: =SEQUENCE(n,,1,0)
J= =c+IF(ISERROR(OFFSET(INDIRECT("A1"),0,0,n,m)),0,0)
Office 365: =SEQUENCE(n,n,1,0)
j= 1 J= 1 1 1
1 1 1 1
1 1 1 1
INDIRECT and OFFSET or volatile functions. If you have access to the MUNIT function, then a simpler way to
ones matrix is to multiply the Identity matrix by 0 and add 1. The vector can be obtained using INDEX to return
column.
j= =INDEX(c+0*MUNIT(n),0,1)
J= =c+0*MUNIT(n)
j= 1 J= 1 1 1
1 1 1 1
1 1 1 1
Formula: =MMULT(b,TRANSPOSE(INDEX(1+0*MUNIT(k),0,1)))
x= 1 X= 1 1 1 1
10 10 10 10 10
100 100 100 100 100
x= 1 10 100 1000
X= 1 10 100 1000
1 10 100 1000
1 10 100 1000
A= 1 2 B= 2 C= 8
3 4 3 18
A 1 2 AT 1 3
3 4 2 4
A 1 56 76 Diagonal 1 0
24 2 98 0 2
34 46 3 0 0
Formula: =b * MUNIT(ROWS(b))
b= 1 Diagonal 1 0 0
2 0 2 0
3 0 0 3
Formula: diag(A) =
Office 365: =LET(a,array,d,SEQUENCE(ROWS(a),,1),INDEX(a,d,d))
A= 1 56 76 diag(A)= 1
24 2 98 2
34 46 3 3
A 1 56 76 trace(A)= 6
24 2 98
34 46 3
A 1 56 76 |A| = 256794
24 2 98
34 46 3
REFERENCES
Array Formula
24.05%
SUMPRODUCT
24.05%
rray formulas.
Last Contacted
9/10/2017
8/5/2017
Largest Sale
$ 1,000.00
$ 300.00
n Result
2 $ 500.00
n Result
2 $ 300.00
Total Sales
$ 1,700.00
$ 300.00
1st 3 Values
1
2
3
1st 3 Values
5
6
7
ing n = m in this
ray result is larger than
1st 3 Values
7
8
9
1st 3 Values
43101
43102
43103