Add 20% to each price
| A | B | C | |
|---|---|---|---|
| 1 | Price | Qty | Item |
| 2 | 20 | 3 | Pen |
| 3 | 15 | 2 | Ink |
| 4 | 8 | 5 | Pad |
Formula: E2: =MAP(A2:A4,LAMBDA(p,ROUND(p*1.2,2)))
Result: Spills down: 24, 18, 9.6
The parameter p stands for each price in turn, and MAP spills one result per price.
Google Sheets supports LAMBDA together with the helper functions MAP, REDUCE, SCAN, BYROW, BYCOL and MAKEARRAY.
LAMBDA(parameter1, …, calculation)A LAMBDA you want in many places is best saved as a named function from the Data menu.
For a fuller explanation of the arguments and common errors, see the LAMBDA Excel guide.
| A | B | C | |
|---|---|---|---|
| 1 | Price | Qty | Item |
| 2 | 20 | 3 | Pen |
| 3 | 15 | 2 | Ink |
| 4 | 8 | 5 | Pad |
Formula: E2: =MAP(A2:A4,LAMBDA(p,ROUND(p*1.2,2)))
Result: Spills down: 24, 18, 9.6
The parameter p stands for each price in turn, and MAP spills one result per price.
| A | B | C | |
|---|---|---|---|
| 1 | Price | Qty | Item |
| 2 | 20 | 3 | Pen |
| 3 | 15 | 2 | Ink |
| 4 | 8 | 5 | Pad |
Formula: E2: =MAP(A2:A4,LAMBDA(p,IF(p>=15,"High","Low")))
Result: Spills down: High, High, Low
The same LAMBDA can contain a decision, here labelling prices of 15 or more.
| A | B | C | |
|---|---|---|---|
| 1 | Price | Qty | Item |
| 2 | 20 | 3 | Pen |
| 3 | 15 | 2 | Ink |
| 4 | 8 | 5 | Pad |
Formula: E2: =REDUCE("",C2:C4,LAMBDA(acc,w,acc&IF(acc="","",", ")&w))
Result: Pen, Ink, Pad
The accumulator acc grows with each word w, and a comma is added from the second word on.
A tiny spreadsheet with example data. Edit the formula or any number and see the result.
Formula in F2: =MAP(C2:C4,LAMBDA(x,x*2))
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Region | Product | Units | Price | Result | |
| 2 | East | Pen | 120 | 2.5 | 240 | |
| 3 | West | Pen | 80 | 2.5 | 160 | |
| 4 | East | Book | 45 | 12 | 90 | |
| 5 | North | Book | 60 | 12 | ||
| 6 | West | Lamp | 30 | 25 | ||
| 7 | East | Lamp | 15 | 25 |
Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.
Enter — commit · F2 — edit · F4 — $ in a reference · Ctrl+C/Ctrl+V — copy and paste · Ctrl+Z — undo
Esc or F6 — leave the sheet for the «Check» button · Shift+Tab in the first cell — back to the page