MAP(array1, [array2, …], lambda) applies a calculation to corresponding positions of one or
more arrays and returns the resulting array. The lambda goes last and takes one parameter per
input array.
=MAP({1;2;3},LAMBDA(x,x*x)) returns a column containing 1, 4 and 9.
With two equally shaped arrays, =MAP({1;2},{10;20},LAMBDA(x,y,x+y)) returns 11 and 22.
Positions are paired; MAP does not form every possible pair of inputs.
Try it
Square the example column, then change x*x to IF(x>1,x*x,0). Use arrays with the same shape
when adapting the two-input example. Mismatched shapes need their own compatibility checks.
Quirks
Microsoft documents #VALUE! when the final argument is not a valid lambda or its parameter
count is wrong. A result must fit one output position; a lambda that returns an array introduces
a separate nested-array problem rather than automatically expanding the result.
A direct error argument and an error inside an array are observably different. On the recorded
Excel build, MAP(NA(),LAMBDA(x,IFERROR(x,3))) returns #N/A before invoking the lambda, while
MAP({#N/A},LAMBDA(x,3)) returns 3. The array element can reach the lambda even though the same
error supplied directly stops the helper.
The result still needs space in the worksheet. A blocked spill can produce #SPILL!; it does
not change the array calculation itself. Try it shows the array without placing it in a workbook.
A direct error stops these array functions; the same error in an array or cell is an element
An error written directly as an argument of these functions is the answer for the whole call. It is not placed in the result: HSTACK(1,#VALUE!) is #VALUE!, not a row holding 1 and an error, and TAKE(#N/A,0) is #N/A. With MAP the LAMBDA does not run at all: MAP(NA(),LAMBDA(xx,IFERROR(xx,3))) is #N/A. The same error inside an array, or in a referenced cell, is an ordinary element: MAP({#N/A},LAMBDA(xx,3)) is 3, and HSTACK(Data!C1,{1;2}) with #N/A in Data!C1 is a 2 by 2 array with #N/A in its first column. TOCOL and TOROW show the difference with ignore 2: TOCOL(#N/A,2) is #N/A, while TOCOL({#N/A},2) drops the error, has nothing left, and is #CALC!. EXPAND is an exception on the cell side: EXPAND(Data!C1,2,2,"pad") is #N/A for the whole call. BYROW and BYCOL check the direct error first too: BYROW(#N/A,#VALUE!) is #N/A, while BYROW({#N/A},2), where 2 is not a LAMBDA, is #VALUE!.
Formula
Excel
Mathematical value
=HSTACK(1,#VALUE!) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#VALUE!
—
=TAKE(#N/A,0) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#N/A
—
=MAP(NA(),LAMBDA(xx,IFERROR(xx,3))) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#N/A
—
=MAP({#N/A},LAMBDA(xx,3)) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
3 0x4008000000000000
—
=HSTACK(Data!C1,{1;2}) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Number supplied through a cell.
Data!C1: #N/A
{#N/A,1;#N/A,2}
—
=TOCOL(#N/A,2) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#N/A
—
=TOCOL({#N/A},2) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#CALC!
—
=EXPAND(Data!C1,2,2,"pad") Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Number supplied through a cell.
Data!C1: #N/A
#N/A
—
=BYROW(#N/A,#VALUE!) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Typed formula.
#N/A
—
=BYROW({#N/A},2) Excel 16.0.20527.20088 Current Channel, Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZAInputs and reference value
Separate the last argument from the input arrays. Validate the callable and its parameter count
without treating it as a displayed error. For a shared input shape, allocate that output shape
and visit each coordinate. Read one value from each input at that coordinate, bind the lambda's
parameters, evaluate its body and store the scalar result at the same coordinate.
Keep direct argument errors distinct from errors held in an array or referenced cell. Passing an
array element through the lambda is necessary for formulas that deliberately replace errors.
Likewise, preserve any callable carried inside an array value.
Test mismatched input dimensions, reference inputs, a lambda returning an array, and the order
of calls to volatile expressions separately. A general array-broadcast rule is not sufficient
evidence for MAP's shape rule. The recorded examples below settle the direct-error distinction;
they do not settle every shape case.
Rust code
Show the CalcFunc source of this function
Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.
No implementation has been published with a Handbook test suite for this function.
Version differences
Microsoft lists MAP for Microsoft 365 and Excel 2024 on Windows and Mac. The build-specific
observations below concern error handling. They do not establish that older or later builds
share every helper-function rule.
Excel 16.0.20527.20088
Windows 64-bit (NT 10.0.26200), x86-64, AMD Ryzen 7 4800H, en-ZA
=MAP(NA(),LAMBDA(xx,IFERROR(xx,3))) returned #N/A. =MAP({#N/A},LAMBDA(xx,3)) returned 3 (0x4008000000000000). Inputs were supplied through formula literals. These are controls from this environment, not a same-input comparison with another build.
Use an ordinary array expression for a simple elementwise calculation such as squaring. Use
BYROW or BYCOL for whole-row or whole-column calculations.
REDUCE carries one accumulator through the array; SCAN also
returns the intermediate accumulators. MAKEARRAY generates values from
row and column indices.