MAKEARRAY function
Builds a grid of a given number of rows and columns, filling each cell with the result of a LAMBDA that receives the row and column number.
Available in Microsoft 365, Excel 2024, Excel for the web, Excel for Mac 2024
Excel 2024 and laterWorks in Google Sheets
Syntax
MAKEARRAY(rows, columns, lambda(row, col))| Argument | What it means | |
|---|---|---|
rows | Required | How many rows the result should have (a whole number of at least 1). |
columns | Required | How many columns the result should have. |
lambda | Required | A LAMBDA with two parameters: the current row number and the current column number. Its result fills that cell. |
Returns: An array of size rows × columns, which spills.
How MAKEARRAY works
MAKEARRAY creates a table from nothing but its size and a rule. Excel loops through every position — row 1 column 1, row 1 column 2, and so on — and calls your LAMBDA with the row and column numbers. Whatever the LAMBDA returns goes into that position. It is the natural tool for multiplication tables, price matrices (unit price × quantity), schedules and test data.
Because the LAMBDA receives positions rather than values, you typically use INDEX inside it to pick the matching row label and column header from other ranges. The rows and columns arguments can themselves be formulas such as ROWS(A2:A4), so the grid resizes with your data.
Examples
1A small multiplication table
| A | B | C | D | |
|---|---|---|---|---|
| 1 | 1 | 2 | 3 | 4 |
| 2 | 2 | 4 | 6 | 8 |
| 3 | 3 | 6 | 9 | 12 |
Three rows and four columns; each cell is its row number times its column number, so row 3, column 4 holds 12.
2Price matrix: unit price × quantity
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Unit price | 1 | 5 | 10 |
| 2 | 2.5 | 2.5 | 12.5 | 25 |
| 3 | 4 | 4 | 20 | 40 |
| 4 | 10 | 10 | 50 | 100 |
For each position, INDEX picks the unit price for that row and the quantity for that column. The 4.00 item ordered in a quantity of 5 costs 20; a quantity of 10 at 10.00 costs 100.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#VALUE! | rows or columns is less than 1 or not a number, or the LAMBDA does not have exactly two parameters. | Pass positive whole numbers and LAMBDA(r, c, ...). |
#CALC! | The LAMBDA returns more than one value for a cell. | Make each call return a single value. |
#SPILL! | The area the grid needs is not empty. | Clear the cells below and to the right. |
Tips
- Use
ROWS()andCOLUMNS()for the size so the grid follows your labels:MAKEARRAY(ROWS(A2:A4), COLUMNS(B1:D1), ...). - For simple outer products, broadcasting is even shorter:
=A2:A4*B1:D1returns the same price matrix in Microsoft 365.
Google Sheets
MAKEARRAY also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.