Syntax
| Parameter | Description |
|---|---|
| array | Parameter of the MAP function. |
| lambda | Parameter of the MAP function. |
Examples
Double every value
=MAP(A1:A10, LAMBDA(x, x*2))
Classify grades
=MAP(B2:B50, LAMBDA(score, IF(score>=90,"A",IF(score>=80,"B",IF(score>=70,"C","F")))))
Two-array MAP
=MAP(A1:A10, B1:B10, LAMBDA(price, qty, price*qty*(1+0.08)))
Common Errors
The arrays have different dimensions, or the LAMBDA doesn't accept the right number of parameters (one per input array).
The LAMBDA produces an error for one or more elements.
Tips
Instead of creating a column with a formula and dragging it down, MAP applies the transformation in one cell that spills the results.
When mapping over 2 arrays, your LAMBDA needs 2 parameters. Three arrays need 3 parameters. Each parameter gets the corresponding element.
The LAMBDA body can use any function: =MAP(A1:A10, LAMBDA(x, UPPER(LEFT(x, 1))&LOWER(MID(x, 2, 100)))) title-cases each string.
Try MAP in Viztab
Import your data and use MAP with 370+ other formulas. No signup required.
Open Viztab