Names and custom functions
LAMBDA function playground
Turns a formula into your own reusable function with named inputs.
The playground runs in your browser. Nothing you type is sent anywhere.
How LAMBDA works
LAMBDA turns a calculation into a function. The parameters are placeholders for the inputs, and the last argument is the calculation that uses them.
Typed on its own, =LAMBDA(x, x*2) returns #CALC! because nothing gives it an input. Call it straight away by adding the inputs in brackets, like =LAMBDA(x, x*2)(5), or name it inside LET.
To reuse it anywhere in a workbook, save it in Formulas > Name Manager under a name such as ADDTAX, then type =ADDTAX(B2). LAMBDA also drives helper functions like MAP and BYROW, which run your calculation on every item or row.
Syntax
=LAMBDA([parameter1, parameter2, ...], calculation)| Argument | What it means |
|---|---|
parameter1, ...optional | Names for the inputs, such as price or qty. Up to 253. They can't look like cell addresses. |
calculationrequired | The last argument: the formula that uses the parameters. |
Examples
| Formula | What it does | Result |
|---|---|---|
=LAMBDA(price,qty,price*qty)(B2,C2) | Call a two-input LAMBDA straight away with B2 and C2. | 480 |
=LET(withtax,LAMBDA(p,p*1.08),withtax(B2)) | Name a LAMBDA inside LET and call it like a function: price plus 8% tax. | $259.20 |
=MAP(B2:B7,C2:C7,LAMBDA(p,q,p*q)) | MAP runs the LAMBDA on each row and spills the line totals. | $480.00 (spills 6×1) |
=BYROW(B2:C7,LAMBDA(r,INDEX(r,1)*INDEX(r,2))) | BYROW hands each row to the LAMBDA as a small range. | $480.00 (spills 6×1) |
=LAMBDA(x,x*2) | Not called, so the result is #CALC!. | #CALC! |
Common mistakes
Related functions
Learn more
The workbook has the same sample data and formulas, plus a practice sheet.