# MAP in Google Sheets: syntax and examples

URL: https://goingstellar.ro/reference/sheets/map/

MAP applies a LAMBDA to each value of an array, or to matching values of several arrays, and returns the results as an array. Use it when a custom calculation per row is too complex for a plain ARRAYFORMULA.

## Syntax

```
MAP(array1, [array2, ...], LAMBDA)
```

## Arguments

- `array1` (array, required: yes): The first array or range. LAMBDA runs once per value.
- `array2, ...` (array, required: no): More arrays of the same size, one LAMBDA argument for each.
- `lambda` (lambda, required: yes): A LAMBDA that takes one name per array and returns one value.

## Examples

The examples use this table, starting in A1:

| A | B |
|---|---|
| 1 | 10 |
| 2 | 20 |
| 3 | 30 |
| 4 | 40 |

```
=MAP(A2:A5, LAMBDA(x, x*x))
```

Result: 

| 1 |
|---|
| 4 |
| 9 |
| 16 |

Square every value in the range. The result spills down. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=MAP(A2:A5, B2:B5, LAMBDA(a, b, a+b))
```

Result: 

| 11 |
|---|
| 22 |
| 33 |
| 44 |

Two ranges: LAMBDA gets one value from each, row by row. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=MAP(A2:A5, LAMBDA(x, IF(x>2, "big", "small")))
```

Result: 

| small |
|---|
| small |
| big |
| big |

Return text based on a condition for every value. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=SUM(MAP(A2:A5, LAMBDA(x, x*x)))
```

Result: `30`

MAP returns an array, so another function can consume it. Run in a Google Sheet (English US locale) on 2026-11-29.

```
=MAP({"a b"; "c d"}, LAMBDA(t, UPPER(t)))
```

Result: 

| A B |
|---|
| C D |

Works on a typed array as well. Run in a Google Sheet (English US locale) on 2026-11-29.

## Common errors

- The LAMBDA needs one name per array. MAP(A2:A5, LAMBDA(x, y, x)) has one array and two names, and returns #N/A.
- All arrays must have the same size. A four-row range with a three-row range returns #VALUE!.
- The last argument must be a LAMBDA. A plain number such as MAP(A2:A5, 5) returns #N/A. A LAMBDA that returns a row such as {x, x} makes MAP spill into two columns.
- The result spills over neighbouring cells, so keep the cells below and to the right empty.

## Compared with Excel

Same syntax in Excel.

## Related functions

- [LAMBDA](https://goingstellar.ro/reference/sheets/lambda/)
- [BYROW](https://goingstellar.ro/reference/sheets/byrow/)
- [REDUCE](https://goingstellar.ro/reference/sheets/reduce/)
- [ARRAYFORMULA](https://goingstellar.ro/reference/sheets/arrayformula/)

## Sources

- [MAP (Docs Editors Help)](https://support.google.com/docs/answer/12568985)

