Example 1
Call a LAMBDA directly
E2 =LAMBDA(price,qty,price*qty)(B2,C2)
Result: 96
The brackets after the LAMBDA pass B2 as price and C2 as qty. 8 x 12 = 96.
E2 =LAMBDA(price,qty,price*qty)(B2,C2) returns 96
Creates your own reusable function from parameters and a calculation. Save it with a name and call it like any other function.
Syntax
=LAMBDA([parameter1, parameter2, …], )
Excel for Microsoft 365, Excel 2024 and later, and Excel for the web. Not available in Excel 2021 or earlier.
Try it
Edit the formula in E2 or change the inputs. The sheet recalculates as you type.
E2 =LAMBDA(price,qty,price*qty)(B2,C2) returns 96
LAMBDA turns a calculation into a function of your own. You choose the inputs and the formula, give the whole thing a name, and from then on you can call it like SUM or XLOOKUP. No VBA is needed.
All arguments except the last are parameters: the names you give to the inputs. The last argument is the calculation, which can use those names. =LAMBDA(price,qty,price*qty) is a function that multiplies two inputs.
A LAMBDA does nothing until it is called. Typing =LAMBDA(price,qty,price*qty) into a cell returns #CALC!, because there is no input yet. To test it, put the inputs in brackets after the closing bracket:
=LAMBDA(price,qty,price*qty)(B2,C2)
Excel runs the calculation with price as B2 and qty as C2 and returns 96. This is the quickest way to try out a LAMBDA before you save it.
Once it works, make it reusable:
NetPrice.=LAMBDA(price,qty,price*qty).=NetPrice(B2,C2).The name is available in every sheet of that workbook. If you change the definition, every cell that uses it updates. That is the point: your logic lives in one place. A named LAMBDA can also call itself, which allows recursion.
Put a parameter in square brackets to make it optional, and test it with ISOMITTED: LAMBDA(x,[y],IF(ISOMITTED(y),x,x+y)). The function can then be called with one or two inputs.
LAMBDA's partners do the looping. MAP runs a LAMBDA on every item, REDUCE accumulates a result, SCAN returns the running values, BYROW and BYCOL apply it to rows and columns, and MAKEARRAY builds a grid from it. You pass the LAMBDA as the last argument.
LET can store a LAMBDA for one formula: =LET(tax,LAMBDA(x,x*0.25),tax(B3)+tax(B4)).
#NAME? in versions that do not support it.qty is fine, q1 is not.LAMBDA needs Microsoft 365, Excel 2024 or later, or Excel for the web.
price, qty. A name can not look like a cell reference. Wrap a name in square brackets, such as [disc], to make it optional. You can have up to 253 parameters.Each example is a live sheet. Change the inputs or the formula and watch the result.
Example 1
E2 =LAMBDA(price,qty,price*qty)(B2,C2)
Result: 96
The brackets after the LAMBDA pass B2 as price and C2 as qty. 8 x 12 = 96.
E2 =LAMBDA(price,qty,price*qty)(B2,C2) returns 96
Example 2
E2 =LAMBDA(r,SUM(r)/COUNT(r))(C2:C6)
Result: 56.6
The parameter r receives the whole range C2:C6. The quantities total 283 across 5 items, so the result is 56.6.
E2 =LAMBDA(r,SUM(r)/COUNT(r))(C2:C6) returns 56.6
Example 3
C2 =LAMBDA(c,c*9/5+32)(A2)
Result: 68
One input, one calculation. Save it in the Name Manager as ToF and you can write =ToF(A2).
C2 =LAMBDA(c,c*9/5+32)(A2) returns 68
Example 4
C2 =LET(tax,LAMBDA(x,x*0.25),tax(A2)+tax(A3))
Result: 40
LET gives the LAMBDA the name tax for this one formula. It is called for 100 and for 60: 25 + 15.
C2 =LET(tax,LAMBDA(x,x*0.25),tax(A2)+tax(A3)) returns 40
Example 5
C2 =LAMBDA(x,x*0.25)
Result: #CALC!
Excel has nothing to run until you supply an input. Add (A2) at the end and the formula returns 25.
C2 =LAMBDA(x,x*0.25) returns #CALC!
Solve it in the sheet. Every answer is checked, with hints if you need them.
Task 1 of 2
In C2, write a LAMBDA with two parameters that multiplies them, and call it with the quantity in A2 and the price in B2.
Answer in C2.
#CALC!. That is expected. Test it by adding the inputs in brackets at the end, such as (B2,C2).(B2,C2), the name returns one fixed result.#NAME? after typing a saved function means the name is misspelled, or the file is open in a version of Excel without LAMBDA. Check the name in the Name Manager.q1 or tax1, are not allowed. Use names like qty or tax_rate.Write a LAMBDA, then save it in the Name Manager: Formulas > Name Manager > New, give it a name and put the LAMBDA in Refers to. Then call it like any function: `=NetPrice(B2,C2)`.
It has no inputs yet, so there is nothing to calculate. Call it with brackets and values, such as `=LAMBDA(x,x*2)(5)`, or use it through a name or a helper function like MAP.
LET names values inside one formula. LAMBDA defines a function with inputs that you can reuse, in one formula, or across the workbook once you give it a name.
Yes, when it is saved as a named function. The name can appear inside its own definition, which lets you write recursive calculations. Always include a condition that stops the recursion.
No. It is available in Microsoft 365, Excel 2024 and later, and Excel for the web. In earlier versions a workbook that uses it shows `#NAME?`.
LAMBDA is taught in Dates and financial modelling, lesson 22: Reusable calculations with LAMBDA. Each lesson is a short, graded exercise like the one above.