Dynamic Array Formulas2
Dynamic Array Formulas2
Go back to top by pressing CTRL+HOME. To start the tour, press CTRL+PAGE DOWN.
Sample datasets
Sample datasets
Create a quick sample dataset like this with only 2 formulas
In cell B9 we have =TEXT(DATE(YEAR(TODAY()),SEQUENCE(1,12),1),"MMM"), which spills the months from
Create
In cell a have
B10 we quick sample dataset like thistowith
=INT(RANDARRAY(6,12)*1000) createonly 2 formulas
a random array of numbers that's 6 rows tall
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next she
Give us feedback on this tutorial
* If you don't have Office 365, you can use this formula: =TEXT(DATE(YEAR(TODAY()),{1,2,3,4,5,6,7,8,9,10,11,12},1)
Previous
Feedback
m Jan - Dec across to M9. The DATE function uses YEAR(TODAY()) as the YEAR argument, then SEQUENCE
by 12 columns wide. The numbers will change each time Excel recalculates.
eet.
Next
E(1,12), creates an array from 1 to 12 for the months, then 1 for the DAY argument. The whole thing is w
wrapped in the TEXT function, which converts the date to MMM text format.
Mathematical operators in a formula
Mathematical operators in a formula
You can use mathematical operators in your formulas > Multiply (*), Divide (/), Add (+), and Subtrac
We have dynamically created month headers in D8:I8, D11:I11, D14:I14, D17:I17, D20:I20, and D23:
UseYou can use
CTRL+PAGE UPmathematical
up to return to theoperators in yourCTRL+PAGE
previous worksheet, formulasDOWN > Multiply (*), to
to advance Divide
the ne
multiply
Give & divide
us feedback examples here. You can try to add & subtract with these e
on this tutorial
Previous
Feedback
ct (-). We've got multiply & divide examples here. You can try to add & subtract with these examples, or your
:I23. Beneath each of those, there are various examples of multiplying (*) and dividing (/) array constants. Yo
eext
(/),sheet.
Add (+), and Subtract (-). We've got
examples, or your own.
Next
r own.
ou can try adjusting the examples to add (+) and subtract (-) on your own.
Square and square root
Square and square root
You can use the caret (^) sign to calculate squares, and the SQRT function to calculate square roots.
We have dynamically created month headers in D8:I8, D11:I11, D14:I14, D17:I17, D20:I20, and D23:
UseYou can use
CTRL+PAGE UPthe
up tocaret
return(^) sign
to the to calculate
previous worksheet,squares, and
CTRL+PAGE DOWNthetoSQRT function
advance to the ne
generate
Give a on
us feedback sequence from 1 to 6, and return the square/square root of eac
this tutorial
Previous
Feedback
Here the arrays generate a sequence from 1 to 6, and return the square/square root of each.
:I23. Beneath each of those, there are various examples of squaring, and calculting square roots.
to sheet.
ext calculate square roots. Here the arrays
ch.
Next
TRANSPOSE function
TRANSPOSE function
You can use the TRANSPOSE function to flip your data the other way around
We have header rows with dynamically generated months in cells D8:I8, D14:I14, and D20:I20. Ther
You
KEEP can use
IN MIND
Somethe
arrayTRANSPOSE function
constants can get to It's
pretty long. flipbetter
yourtodata the other
use SEQUENCE way aroun
to automatically
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the ne
Give us feedback on this tutorial
Previous
Feedback
e are 3 x 6 arrays beneath them using the TRANSPOSE function to flip the arrays the other way around.
ynd
build them for you.
ext sheet.
Next
Reference existing arrays
Reference existing arrays
You can use the spilled range operator (#) to reference a dynamic array. If the array range changes, the s
We have dynamically generated header months in cells D8:I8, D13:I13, D18:I18, and D23:I23. Beneath th
UseYou can use
CTRL+PAGE UPthe
up tospilled range
return to operator
the previous (#) toCTRL+PAGE
worksheet, reference DOWNa dynamic
to advancearray.
to the Ifnext
thesh
operator
Give willonautomatically
us feedback this tutorial adjust.
Previous
Feedback
pilled range operator will automataically adjust.
hose are 3 x 6 arrays. The first and third examples use array functions to populate those ranges, while the sec
array range changes, the spilled range
heet.
Next
cond and fourth examples use the spilled range operator (#) to dynamically reference the arrays above t
them. For example, =D9# will return the array that's spilled to cells D9:I11.
Count or return characters
Count or return characters
You can use arrays to count how many characters are in text strings, or even find the shortest and longest
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next sh
You
Give can useonarrays
us feedback to count how many characters are in text strings, or even fin
this tutorial
As a bonus, we used the CONCAT function to convert the text strings into a pro
Previous
Feedback
t text strings. As a bonus, we used the CONCAT function to convert the text strings into a proper sentenc
eet.
nd the shortest and longest text strings.
oper sentence.
),LEN(C9:C13),0),1)}
,LEN(C9:C13),0),1)}
Next
ce.
Nth values
Nth values
You can use arrays to return the Nth largest or smallest values from a set with the SMALL & LARGE functions
We have a series of random numbrs in cells B9:B18 populated with =INT(RANDARRAY(10,1)*100). There is a varia
To You can
get the Nthuse arrays
smallest to we
values, return the Nth largest or smallest
used =SMALL(B9#,SEQUENCE(D9)), whichvalues
uses thefrom
spilledarange
set with thetoSM
operator lo
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next sheet.
Give us feedback on this tutorial
Data Value Nth Smallest Nth Largest SUM of Nth Smallest values
#NAME? 3 #NAME? #NAME? #NAME? {=SUM(SM
#NAME? #NAME? #NAME?
#NAME? #NAME? #NAME? SUM of Nth largest values
#NAME? #NAME? {=SUM(LA
#NAME?
#NAME? Average of Nth Smallest values
#NAME? #NAME? {=AVERAG
#NAME?
#NAME? Average of Nth largest values
#NAME? #NAME? {=AVERAG
Previous
Feedback
able value in cell D9 that you can change to adjust the output of the Nth smallest or largest values in the
MALL & LARGE
ook in the functions
array beginning in cell B9, then the sequence function creates an array the same size as the va
MALL(_xlfn.ANCHORARRAY(B9),_xlfn.SEQUENCE(D9)))}
RGE(_xlfn.ANCHORARRAY(B9),_xlfn.SEQUENCE(D9)))}
s
GE(SMALL(_xlfn.ANCHORARRAY(B9),_xlfn.SEQUENCE(D9)))}
GE(LARGE(_xlfn.ANCHORARRAY(B9),_xlfn.SEQUENCE(D9)))}
Next
e list. It's currently set to 3. The Nth smallest values are listed beginning in cell F9, and the Nth largest val
alue entered in cell D9.
lues are start in cell H9. Tehre are additional formulas in cells J9, J12, J15, and J18.
Errors
Errors
You can use arrays to ignore or count errors in your data where normal functions would fail
We have sample data in cells C9:C18, which has been defined as "Data". There is a #VALUE! Error in cell
You canCuse
EXPERIMENT
arrays
an you tomaximum
find the ignore value
or count
in the errors
range? in your data where normal functi
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next s
Give us feedback on this tutorial
Previous
Feedback
C11, and a #N/A error in cell C14. These error values will prevent most formulas, like SUM or COUNT fro
ons would fail
sheet.
Next
om functioning properly, and they will instead return errors of their own. In cell E9 we used =SUM(IF(ISE
RROR(Data),"",Data)) to sum the data and ignore the error. In cell E12 we used =SUM(IF(ISERROR(Data),
,1,0)) to count the number of errors in the data range. We calculate the average in cell E15, and the min
umum value in cell E18. You can try to create a few of your own using COUNT or MAX.
Conditions
Conditions
You can use arrays calculate based on certain conditions
We have data by sales rep and month in cells C9:E24, where column E has been defined as "Sales". There are seve
YouTHE
HERE'S canKEY
use
Usearrays to calculate
the asterisk based
(*) for the AND on certain
operator, conditions
and the Plus (+) sign for the OR operator.
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next sheet.
Give us feedback on this tutorial
Previous
Feedback
eral examples of formulas to sum based on different conditions in cells G8, G10, G12, and G14. For exam
Sales>0,Sales))}
ales>0)*(Sales<=2500)*(Sales))}
(Sales>0)+(Sales<2500),Sales))}
GE(IF(Sales<>0,Sales))}
Next
mple, cell G8 has the formula =SUM(IF(Sales>0,Sales)), which sums all cells in the Sales column that are gr
reater than 0.
Count the number of differences between two ranges of cells
Count the number of differences between two ranges of c
You can use arrays to compare data sources for differences
We have two tables of monthly sales in cells B9:D23 and F9:F23 with headers in row 8. Column D, the sales c
YouTOcan
GOOD use
KNOW
arrays
Qtr_1 to compare
is a named range for data sources
Qtr_2for
cells D9:D23
is adifferences
named range for cells H9:H23
Use CTRL+PAGE UP up to return to the previous worksheet, CTRL+PAGE DOWN to advance to the next sheet
Give us feedback on this tutorial
Sales Rep Month Sales Sales Rep Month Sales Count the number of d
Tom January 7,825 Tom April 6,707 15 {=SUM(IF(
Fred January 5,433 Fred April 7,557
Amy January 254 Amy April 8,094 Find the row # of the m
Sal January 4,971 Sal April 4,897 21 {=MIN(IF(Q
Fritz January 5,796 Fritz April 6,916
Tom February 4,398 Tom May 1,338 Find the row # of the m
Fred February 2,870 Fred May 8,043 11 {=MAX(IF(
Amy February 7,861 Amy May 1,623
Sal February 4,934 Sal May 810 Find the address of the
Fritz February 8,047 Fritz May 1,066 $D$21 {=ADDRES
Tom March 1,427 Tom June 9,681
Fred March 7,970 Fred June 9,451 Find the address of the
Amy March 8,379 Amy June 6,235 $D$11 {=ADDRES
Sal March 1,938 Sal June 867
Fritz March 956 Fritz June 2,847
Previous
Feedback
cells
column has been defined as Qtr_1, while column H has been defined as Qtr_2. There are comparison arr
t.
Next
rays in cells J9, J11, J13, J15, and J17. For instance, in cell J9 we have =SUM(IF(Qtr_1=Qtr_2,0,1)), which
counts the number of differences between two ranges. There are descriptions of what each formula doe
es starting in cell L9.
Learn more - Scroll down to cells B11, D11, and F11 for links to other information
Learn more
Use CTRL+PAGE UP to return to the previous worksheet
Give us feedback on this tutorial
Check out these other resources for more information
Previous
Feedback
More resources
Training courses
Tech community
Excel blog
Make a suggestion at Excel User Voice