FormulaCamp
Completed
← Google Sheets functions
Google Sheets function

LAMBDA in Google Sheets

Google Sheets supports LAMBDA together with the helper functions MAP, REDUCE, SCAN, BYROW, BYCOL and MAKEARRAY.

Syntax (same in Google Sheets)

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.

Worked examples in Google Sheets

Add 20% to each price

ABC
1PriceQtyItem
2203Pen
3152Ink
485Pad

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 rule with IF

ABC
1PriceQtyItem
2203Pen
3152Ink
485Pad

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.

Build a text list

ABC
1PriceQtyItem
2203Pen
3152Ink
485Pad

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.

Try it

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))

Example spreadsheet for LAMBDA
ABCDEF
1RegionProductUnitsPriceResult
2EastPen1202.5240
3WestPen802.5160
4EastBook451290
5NorthBook6012
6WestLamp3025
7EastLamp1525
Result in F2: 240
Practice this in a lesson: LAMBDA, MAP, REDUCE, BYROW

Frequently asked questions

Which functions run a LAMBDA in Google Sheets?
MAP, REDUCE, SCAN, BYROW, BYCOL and MAKEARRAY take a LAMBDA and apply it to ranges. Named functions can also hold one under a reusable name.

Google Sheets is used here only as a descriptive product name. FormulaCamp is not affiliated with Google.