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)| Argument | What it means | |
|---|---|---|
array1 | Required | The first range or array to process. |
array2, ... | Optional | Further arrays of the same size; their values are passed to the LAMBDA side by side. |
lambda | Required | A 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
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Sales | |
| 2 | Ana | 1250 | 125 |
| 3 | Ben | 800 | 0 |
| 4 | Cleo | 2100 | 210 |
| 5 | Dan | 950 | 0 |
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
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Qty | Price | |
| 2 | Pens | 3 | 4.5 | 13.5 |
| 3 | Folders | 10 | 2.2 | 22 |
| 4 | Toner | 6 | 12 | 72 |
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
| A | B | C | |
|---|---|---|---|
| 1 | Batch | Weight (g) | |
| 2 | B-01 | 498 | TRUE |
| 3 | B-02 | 512 | FALSE |
| 4 | B-03 | 503 | TRUE |
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.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#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.