MAKEARRAY function in Google Sheets
Returns an array of specified dimensions with values calculated by application of a LAMBDA function.
=MAKEARRAY(rows, columns, LAMBDA)MAKEARRAY syntax and parameters
Three arguments, three required.
- rowsnumberRequired
The number of rows to return.
- columnsnumberRequired
The number of columns to return.
- LAMBDAanyRequired
A LAMBDA that’s applied to create the array. Syntax: LAMBDA(name1, name2, formula_expression) Learn more about LAMBDA functions. Requirements: The LAMBDA must have exactly 2 name arguments along with a formula_expression which uses those names. When applying the LAMBDA, name1 resolves to the current row_index and name2 resolves to the current column_index.
MAKEARRAY examples
Formulas you'll actually reuse.
A 12×12 multiplication table from row and column indexes:
=MAKEARRAY(12, 12, LAMBDA(r, c, r * c))A 5×3 grid with ones on the diagonal:
=MAKEARRAY(5, 3, LAMBDA(r, c, IF(r = c, 1, 0)))
MAKEARRAY in Excel
Same name — your formula ports as-is.
Try MAKEARRAY in the playground
Edit the example — nothing to install.
Preloaded with the MAKEARRAY formula from Example 1 — change anything and watch it respond.
Related functions
More ways Google Sheets gets this done.
- BYCOLGroups an array by columns by application of a LAMBDA function to each column.ArrayExcel
- BYROWGroups an array by rows by application of a LAMBDA function to each row.ArrayExcel
- CHOOSECOLSCreates a new array from the selected columns in the existing range.ArrayExcel
- CHOOSEROWSCreates a new array from the selected rows in the existing range.ArrayExcel
- HSTACKAppends ranges horizontally and in sequence to return a larger array.ArrayExcel
- LINESTGiven partial data about a linear trend, calculates various parameters about the ideal linear trend using the least-squares method.ArrayExcel