Logical function

MAP function

Applies a LAMBDA to every value in one or more arrays and returns an array of results of the same size.

Available in Microsoft 365, Excel 2024, Excel for the web, Excel for Mac 2024

Excel 2024 and laterWorks in Google Sheets

Syntax

MAP(array1, [array2, ...], lambda)
ArgumentWhat it means
array1RequiredThe first range or array to process.
array2, ...OptionalFurther arrays of the same size; their values are passed to the LAMBDA side by side.
lambdaRequiredA LAMBDA with one parameter per array. It is called once per element and its result goes into the matching position. Always the last argument.

Returns: An array the same shape as array1, which spills.

How MAP works

MAP is "do this to every item". It walks through a range cell by cell, hands each value to a LAMBDA, and places the answer in the same position of the result. With two or more ranges it walks through them in step, so the LAMBDA sees the first quantity with the first price, the second with the second, and so on.

Many simple calculations already work element by element in Microsoft 365 (=B2:B5*10% spills on its own). MAP becomes useful when the logic does not: functions that summarise a range, such as AND, OR or SUM, or several steps of IF logic per item. Inside MAP each call sees a single value, so AND(x>0, x<100) is tested per cell rather than for the whole range.

Examples

1Bonus only for sales of 1,000 or more

C2fx=MAP(B2:B5, LAMBDA(s, IF(s>=1000, s*10%, 0)))
ABC
1RepSales
2Ana1250125
3Ben8000
4Cleo2100210
5Dan9500

Each sales figure is passed in as s. Ana (1,250) earns 125, Cleo (2,100) earns 210; the others are below 1,000 and get 0.

2Line totals from two columns

D2fx=MAP(B2:B4, C2:C4, LAMBDA(q, p, q*p))
ABCD
1ItemQtyPrice
2Pens34.513.5
3Folders102.222
4Toner61272

MAP pairs the quantity and price from the same row: 3 × 4.5 = 13.5, 10 × 2.2 = 22 and 6 × 12 = 72.

3Range check per cell with AND

C2fx=MAP(B2:B4, LAMBDA(w, AND(w>=495, w<=505)))
ABC
1BatchWeight (g)
2B-01498TRUE
3B-02512FALSE
4B-03503TRUE

Written without MAP, AND(B2:B4>=495, B2:B4<=505) would give one answer for all batches. Inside MAP, AND tests each weight separately: B-02 at 512 g is out of tolerance.

⬇Practice workbookExamples with live formulas + practice sheets · .xlsx · 16 KB

Common errors and how to fix them

ErrorWhy it happensFix
#VALUE!The arrays have different sizes, or the LAMBDA's parameter count does not match the number of arrays.Use ranges of the same shape and one parameter per array.
#CALC!The LAMBDA returns more than one value for an element.Return a single value per call.

Tips

  • Prefer ordinary array maths (=B2:B4*C2:C4) when it works — it is shorter. Reach for MAP when you need AND/OR, aggregation or multi-step logic per item.
  • MAP keeps the shape of the input: a 3×2 range returns a 3×2 result.

Google Sheets

MAP also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.