Spreadsheet Practice

LAMBDA function

Quick answer

LAMBDA creates your own function from a formula: name the inputs, then write the calculation, as in LAMBDA(price, rate, price*(1+rate)).

Syntax
=LAMBDA([parameter1], [parameter2], ..., calculation)
Most common use
=LAMBDA(p,r,p*(1+r))(A2,B2) returns $86.40 (Defined and called in one formula)

Call it at once with values in parentheses after it, give it a name with LET or the Name Manager, or pass it to MAP, BYROW, REDUCE and the other helpers that run it on every row or value.

Available in
Excel 2024 and Microsoft 365
Category
Dynamic array functions
Returns
A function. On its own in a cell it shows #CALC!; called with values, it returns the calculation's result.
Google Sheets
Available in Google Sheets, where saved ones are called named functions.

Syntax

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

ArgumentRequired?What it is
parameter1OptionalA name for the first input, such as price. Avoid names that look like cell addresses, such as A1.
parameter2OptionalOptional: names for more inputs.
calculationRequiredThe formula that uses the inputs. Its result is the function's result.

Examples

Each result below is calculated from the sample sheet by our formula engine, the same one that grades the practice.

CellFormulaResultWhat it shows
C2=LAMBDA(p,r,p*(1+r))(A2,B2)$86.40Defined and called in one formula
C3=LET(withTax,LAMBDA(p,r,p*(1+r)),withTax(A3,B3))$132.81Named with LET, then called by name
C4=MAP(A2:A3,B2:B3,LAMBDA(p,r,ROUND(p*(1+r),2)))$86.40spills 2 × 1Passed to MAP to run on every row

Try it live

This is the sample sheet. Change any number or text, or edit a formula, and the results update.

Show the sample data as a table
PriceTax rateResult
$80.008%$86.40
$125.006.25%$132.81
$86.40
$132.81

Practice LAMBDA

Graded instantly, then re-checked on changed data.

Your own discount function

In D2, use LAMBDA to define a calculation with two inputs, a price and a discount rate, that returns the discounted price, and call it on B2 and C2. Fill down to D6.

Common mistakes

What you seeWhy, and how to fix it
#CALC! in the cellA LAMBDA on its own is a function, not a value. Call it with values after it: =LAMBDA(x,x*2)(A2).
#VALUE!You passed more or fewer values than the LAMBDA has inputs.
#NAME?An input name looks like a cell address, such as TAX1, or is spelled differently in the calculation.

Tips

  • In Excel, save a LAMBDA in Formulas > Name Manager with a name such as ADDTAX, and use =ADDTAX(A2,B2) anywhere in the workbook.

Questions

What is LAMBDA in Excel?

A way to define your own function with a formula. LAMBDA(x, x*2) is a function that doubles its input.

How do I reuse a LAMBDA?

Name it in the Name Manager in Excel or as a named function in Google Sheets, or name it with LET inside one formula.

Updated Checked by running: every formula on this page was run by our formula engine on .