Excel’s LET function gives names to values or calculations inside a formula, while LAMBDA turns a formula into a reusable custom function. Used together, LET can make a LAMBDA easier to read by naming its inputs and intermediate steps; use LAMBDA when you want to reuse logic, and LET when you want to organize one formula.
What LET and LAMBDA do
LET and LAMBDA are related but serve different purposes. LET creates local names that exist only while Excel calculates that formula. LAMBDA defines a function with optional parameters and a calculation, so you can call it directly or save it as a named function for use elsewhere in a workbook.
Both are available in Microsoft 365 and Excel 2024. LET is also available in Excel 2021. Availability can depend on the Excel edition and update channel, so an older installation may not recognize a formula even if it opens a workbook containing one.
- LET: name a value or repeated calculation within a formula.
- LAMBDA: package a calculation into a function that accepts inputs.
- Together: use named intermediate values inside a reusable function.
How LET works
LET follows the pattern =LET(name1, value1, calculation). You can define several name-and-value pairs, then finish with the calculation that uses them. Names are local to that formula; they do not create worksheet cells, named ranges, or variables that other formulas can automatically access.
For example, with a price in A2 and a discount rate in B2, the formula =LET(price, A2, discount, B2, price*(1-discount)) calculates the discounted price. If A2 contains 100 and B2 contains 10%, the result is 90. The names make the calculation easier to follow than repeating cell references, and Excel can reuse a named calculation within the formula rather than evaluate the same expression repeatedly.
LET names must follow Excel’s naming rules. For instance, a name that Excel interprets as a cell reference is not suitable. Use clear names such as unitPrice or discountRate, and avoid names that conflict with function names or workbook references.
How LAMBDA works
A LAMBDA formula has the general structure =LAMBDA(parameter1, calculation). Parameters are placeholders for values supplied when you call the function. To try one directly in a cell, add the arguments after the LAMBDA expression. With a number in A2, the formula =LAMBDA(number, number*number)(A2) returns the square of that number. If A2 is 5, the result is 25.
A LAMBDA written without arguments defines the function but does not yet provide the parameter values it needs. That is why entering a standalone definition in a cell can return a calculation error. To make a reusable function, save the LAMBDA through Name Manager:
- On Windows, choose Formulas > Name Manager > New.
- Enter a descriptive name, such as
SquareNumber. Names cannot contain spaces. - In Refers to, enter
=LAMBDA(number, number*number), then select OK. - Use the function in a worksheet with
=SquareNumber(A2).
On Excel for Mac, use Formulas > Define Name to create a name; the precise dialog presentation can differ by release. Excel for the web supports many modern formulas, but creating or managing defined names may be more limited than in the desktop app, so use the desktop Name Manager if the needed control is unavailable.
Using LET inside LAMBDA
LET is especially useful inside LAMBDA when the calculation has meaningful stages. Suppose a business wants to calculate a price after discount and then add tax. With the original price, discount rate, and tax rate in A2, B2, and C2, respectively, this direct formula returns the final amount: =LET(discountedPrice, A2*(1-B2), discountedPrice*(1+C2)). If those cells contain 100, 10%, and 8%, the result is 97.2.
To turn that calculation into a reusable function, define a name in Name Manager whose Refers to entry is =LAMBDA(price, discount, tax, LET(discountedPrice, price*(1-discount), discountedPrice*(1+tax))). Then call it with =NetPrice(A2,B2,C2), assuming the saved name is NetPrice. For the example values above, it returns 97.2. This is an illustrative calculation, not guidance on how taxes should be applied in any particular situation.
Giving the intermediate result a name clarifies that tax is applied after the discount. It also makes a longer formula easier to review and update. Keep the names specific enough to distinguish each stage, and make sure the function’s parameters and the order of arguments in its calls agree.
When to choose each function
- Use LET to reduce repetition or explain a complicated formula that will be used in one place.
- Use LAMBDA when the same calculation belongs in several formulas or should have a recognizable function name.
- Use both when a reusable calculation has intermediate steps that benefit from descriptive names.
- Use an ordinary formula when the calculation is short, used once, and already easy to understand.
A named LAMBDA is a workbook-level convenience, not a new built-in Excel function available automatically in every workbook. If someone opens the file in a version that does not support LAMBDA, the function may not calculate correctly. For workbooks shared with users on older versions, consider compatibility and explain any custom names the recipient needs to use.
Common errors and troubleshooting
#CALC! commonly appears when a LAMBDA is defined but not called with the necessary arguments. Test a LAMBDA by appending sample arguments, or save it as a name and call that name with the right number of inputs. A mismatch between the defined parameters and supplied arguments can also cause problems.
#NAME? may indicate that Excel does not recognize LAMBDA, LET, or the name you created. Check the Excel version, spelling, and whether the name is defined in the workbook you are using. If Excel displays a formula error as soon as you type it, confirm that the formula uses commas as separators; some regional settings use semicolons instead, even though comma-separated syntax is standard in the examples here.
If a named LAMBDA works in one workbook but not another, the function name may not be defined in the second workbook. Defined names belong to a workbook unless deliberately managed and transferred. When copying formulas between files, check Name Manager and include the required name definitions.
Frequently Asked Questions
What is the difference between LET and LAMBDA in Excel?
LET names values or calculations within a single formula. LAMBDA defines a function that accepts inputs and can be reused, especially when saved as a workbook name.
Can I use LET without LAMBDA?
Yes. LET works on its own to organize a formula, give repeated expressions names, and make the final calculation easier to understand.
Can I use LAMBDA without LET?
Yes. A simple LAMBDA can calculate directly from its parameters. LET is optional and is helpful when the function has intermediate calculations or repeated expressions.
Why does my LAMBDA return #CALC!?
A LAMBDA entered by itself has no argument values to calculate with. Call it with the required inputs, or save it as a name and supply those inputs when using that name.
Are LET and LAMBDA available in every Excel version?
No. LET is available in Microsoft 365 and Excel 2021 or later; LAMBDA requires Microsoft 365 or Excel 2024. Check the version used by everyone who needs to open the workbook.
Related
- Google Sheets IF Function: How It Works and Examples
- Google Sheets IF Function: Syntax and Examples
- Google Sheets IF Function: Syntax, Examples & Tips
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- COUNTIF Within a Range: How to Count Cells That Meet a ConditionThe direct answer: use the COUNTIF function with a range and a criterion, like =COUNTIF(A2:A100, "Yes"), which counts…
- How to Build a VLOOKUP in ExcelTo build a VLOOKUP, enter a formula that names the value to find, the lookup table, the return-column…
- Calculating Moving Average in Excel: Formulas and TipsTo calculate a moving average in Excel, average a fixed-size group of consecutive values, then copy the formula…
- Excel INDEX MATCH Formula: How to Use It in Microsoft ExcelIn Microsoft Excel, combine INDEX and MATCH to find a value in one range and return the value…
- Excel MID Cell Reference: Extract Text from a CellTo extract characters from a cell in Excel, use the MID function with that cell as its first…
- Box Plot Formula: Quartiles, IQR, and WhiskersA box plot has no single formula: it is built from a five-number summary—minimum, first quartile (Q1), median,…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.