ID EN
#Dynamic array

MAKEARRAY

Excel Functions

Create array with calculated values

Syntax

EXCEL
=MAKEARRAY(rows, columns, function)

Arguments

Parameter Description
rows The number of rows to create.
columns The number of columns to create.
function The custom LAMBDA calculation to apply.

Return Value

An array of calculated values

Details

The MAKEARRAY function returns an array with specified rows and columns, based on a custom LAMBDA calculation. MAKEARRAY can be used to create arrays with variable dimensions that are calculated. The generic syntax for MAKEARRAY looks like this: The MAKEARRAY function takes three arguments: rows, columns, and function. Rows is the number of rows to create, and columns is the number of columns to create. The function is a custom LAMBDA (see below) to use when creating values in the array. The total number of values in the array returned by MAKEARRAY will equal rows * columns. The MAKEARRAY uses the LAMBDA function to apply the function used to calculate array values. The structure of the LAMBDA used by MAKEARRAY is: where r represents the row count, c represents the column count originally

Examples

Example 1

The MAKEARRAY function returns an array with specified rows and columns, based on a custom LAMBDA calculation. MAKEARRAY can be used to create arrays

EXCEL
=MAKEARRAY(rows,columns,function)
LAMBDA structure

The MAKEARRAY uses the LAMBDA function to apply the function used to calculate array values. The structure of the LAMBDA used by MAKEARRAY is:

EXCEL
LAMBDA(r,c,calculation)
Examples

In the formula below, MAKEARRAY is used to create an array with 2 rows and 3 columns, populated with the result multiplying rows by columns:

EXCEL
=MAKEARRAY(2,3,LAMBDA(r,c,r*c)) // returns {1,2,3;2,4,6}
Examples

The result is a 2 x 3 array with six values {1,2,3;2,4,6}. The calculation can be a hardcoded value as well. Below are examples of the same formula, w

EXCEL
=MAKEARRAY(2,3,LAMBDA(r,c,0)) // returns {0,0,0;0,0,0}
=MAKEARRAY(2,3,LAMBDA(r,c,"x")) // returns {"x","x","x";"x","x","x"}
Random values

MAKEARRAY can be used to generate random values. In the formula below. The CHAR function is used with the RANDBETWEEN function to generate random uppe

EXCEL
=MAKEARRAY(2,3,LAMBDA(r,c,CHAR(RANDBETWEEN(65,90))))

See Also

LAMBDA LET MAP SCAN REDUCE MAKEARRAY BYCOL BYROW