Numbers Exercises

LET, LAMBDA, MAP and REDUCE in Numbers Explained

Last updated:

Short answer: LET gives a name to a value inside a formula. LAMBDA makes your own function, and MAP, REDUCE and SCAN apply it to a range. For example =LET(Rate,10,Rate*7) returns 70.

The examples use this table.

Table 1
ABC
1ProductPriceQty
2Apple410
3Pear65
4Kiwi122
5Grape83

Name a value with LET

LET pairs a name with a value and ends with the calculation that uses it. The formula becomes shorter and easier to read, and the value is only written once.

=LET(Rate,10,Rate*7)
Result: 70

Make your own function with LAMBDA

LAMBDA defines input names and a calculation. To try it directly in one cell, hand it to LAMBDA.APPLY. This converts 212 degrees Fahrenheit to Celsius.

=LAMBDA.APPLY(212,LAMBDA(temp,(temp-32)*5/9))
Result: 100

Apply it to every value with MAP

MAP runs a LAMBDA on each value of a range and returns a range of the same shape. Here every price is doubled and the results are added up.

=SUM(MAP(B2:B5,LAMBDA(x,x*2)))
Result: 60

Collapse a range with REDUCE

REDUCE walks through a range and keeps a running result. You give a start value and a LAMBDA with two names: the result so far and the next value. This adds the squares of the prices.

=REDUCE(0,B2:B5,LAMBDA(acc,v,acc+v*v))
Result: 260

Keep every step with SCAN

SCAN works like REDUCE but returns each intermediate result, which is perfect for a running total. The fourth value is the total of all four prices.

=INDEX(SCAN(0,B2:B5,LAMBDA(acc,v,acc+v)),4)
Result: 30

Choose between several outcomes with IFS

IFS checks conditions in order and returns the first match. End with TRUE for a default. It is clearer than a long chain of nested IF functions.

=IFS(B3>10,"high",B3>5,"mid",TRUE,"low")
Result: mid

Frequently asked questions

What is LET used for in Numbers?

LET names intermediate values inside a formula so you can reuse them. It makes long formulas shorter and easier to read.

What is the difference between MAP and REDUCE?

MAP returns one result for every value in a range. REDUCE combines all values into a single result.

How do I test a LAMBDA in a cell?

Use LAMBDA.APPLY, for example =LAMBDA.APPLY(212,LAMBDA(temp,(temp-32)*5/9)).

Functions in this article

Practise it yourself

Type the formula yourself in a real exercise and see right away if your answer is correct. The first exercises are free.

Start practising