Excel functions / Logical

LAMBDA function

Makes a function of your own: names for its inputs, then the calculation.

Syntax

=LAMBDA(parameter1, [parameter2], …, calculation)

Arguments

When to use it

LAMBDA turns a calculation into a function of your own. You name its inputs, then write the calculation with those names: LAMBDA(net, rate, net*(1+rate)) is a function that adds tax to a price.

A LAMBDA does nothing until it is given values. There are three ways to do that: put them in brackets straight after it, give it a name with LET and call that name, or hand it to a function such as MAP, REDUCE or BYROW, which calls it once for each item.

Examples

  1. Try a LAMBDA by giving it values straight away

    ABCD
    1NetVAT rate
    220020%240

    In D2: =LAMBDA(net, rate, net*(1+rate))(A2, B2) → 240

    Try this example

  2. Name it with LET, then use it more than once

    ABCD
    1WidthHeight
    23416

    In D2: =LET(area, LAMBDA(w, h, w*h), area(A2, B2) + area(2, 2)) → 16

    Try this example

  3. One calculation for every row

    ABC
    1Net
    2100120
    3250300
    44048

    In C2: =MAP(A2:A4, LAMBDA(net, net*1.2)) → 120; 300; 48

    Try this example

Common mistakes

In Excel you can save a LAMBDA under a name in Formulas → Name Manager, then use it anywhere in the workbook like a built-in function. This site has no saved names, so name it inside the formula with LET.

Common questions

What is the LAMBDA function in Excel?

LAMBDA lets you write your own function with a formula, without VBA. You list the inputs and then the calculation, for example =LAMBDA(x, x*2), and save it under a name or use it inside MAP, REDUCE and BYROW.

Try LAMBDA in the playground

Practise it

Related functions