Function · Dynamic arrays
Excel MAKEARRAY function
The Excel MAKEARRAY function spills a grid from a LAMBDA of the row and column. Two units at $1,200 and $1,450, plus $50 a month, fill a 3 by 2 grid.
Syntax =MAKEARRAY(rows, cols, lambda(row, col))
=MAKEARRAY(3,2,LAMBDA(r,c,INDEX($B$2:$C$2,1,c)+(r-1)*50))Arguments
| Name | Required | What to pass |
|---|---|---|
| rows | Required | How many rows to spill. The count has to be 1 or greater. |
| cols | Required | How many columns to spill. The count has to be 1 or greater. |
| lambda | Required | A LAMBDA with two parameters. The first is the row number and the second is the column number. Both start at 1. The LAMBDA returns one value for that cell. |
Examples
A 3 by 3 table of the row times the column
=MAKEARRAY(3,3,LAMBDA(r,c,r*c))Result 1, 2, and 3, then 2, 4, and 6, then 3, 6, and 9
Two rents, stepping $50 a month from 1/1/2026
=MAKEARRAY(3,2,LAMBDA(r,c,INDEX($B$2:$C$2,1,c)+(r-1)*50))Result $1,200 and $1,450, then $1,250 and $1,500, then $1,300 and $1,550
Three prices, and the same prices plus 8.25%
=MAKEARRAY(3,2,LAMBDA(r,c,INDEX(A1:A3,r)*IF(c=1,1,1.0825)))Result $49 and $53.0425, $12 and $12.99, and $8 and $8.66
| A | B | C | |
|---|---|---|---|
| 1 | Unit A | Unit B | |
| 2 | Base | 1200 | 1450 |
| 3 | 1/1/2026 | 1200 | 1450 |
| 4 | 2/1/2026 | 1250 | 1500 |
| 5 | 3/1/2026 | 1300 | 1550 |
MAKEARRAY builds a grid of the size you choose. The LAMBDA runs once per cell. Its first parameter is the row number and its second is the column number. Both start at 1. =MAKEARRAY(3,3,LAMBDA(r,c,r*c)) spills three rows and three columns. The first row is 1, 2, 3. The second is 2, 4, 6. The third is 3, 6, 9. Row 2, column 3 is 2 × 3, which is 6.
LibreOffice does not have MAKEARRAY, so the shapes on this page were checked by running the same row-and-column rule in Python. The product is 3 by 3. The rent grid is 3 by 2.
The rent grid gives the row and the column different jobs. B2 is $1,200 and C2 is $1,450, the base for unit A and unit B. =MAKEARRAY(3,2,LAMBDA(r,c,INDEX($B$2:$C$2,1,c)+(r-1)*50)) reads the base with INDEX and adds $50 for each month after the first. The month of 1/1/2026 is $1,200 and $1,450. The month of 2/1/2026 is $1,250 and $1,500. The month of 3/1/2026 is $1,300 and $1,550.
Prices of $49, $12, and $8 in A1:A3 become a price column and a tax-included column with =MAKEARRAY(3,2,LAMBDA(r,c,INDEX(A1:A3,r)*IF(c=1,1,1.0825))). The spill is $49 and $53.0425, then $12 and $12.99, then $8 and $8.66. 49 × 1.0825 displays as 53.0425. 12 × 1.0825 is 12.99. 8 × 1.0825 is 8.66. MAP applies this same 8.25% to one column of prices. MAP walks values you already have. MAKEARRAY starts from the size of the grid.
SEQUENCE writes a straight run. SEQUENCE(3,1,1200,50) is $1,200, $1,250, and $1,300, which is unit A on its own. The second unit needs the column number. That is the parameter MAKEARRAY passes in.
A LAMBDA that returns an array for one cell is #CALC!. =MAKEARRAY(2,2,LAMBDA(r,c,SEQUENCE(2))) does that, because SEQUENCE(2) is two numbers. A LAMBDA with one parameter, or with three, is #VALUE!, which Excel labels Incorrect Parameters. A row count or a column count below 1, or a count that is not a number, is #VALUE! as well. A value sitting in the spill block is #SPILL!. Excel 2021 returns #NAME?.
BYROW and BYCOL hand a whole row or a whole column to a LAMBDA and want one value back. REDUCE folds a list to one value, and SCAN spills every step of that fold. LAMBDA is the function the third argument builds. The month sequence LAMBDA spills July 1, August 1, and September 1, 2026 from July 4, 2026. Google Sheets has MAKEARRAY. A LAMBDA with the wrong number of parameters is #N/A in Google Sheets and #VALUE! in Excel.