What LET does
LET stores values under names inside a formula, then uses those names in the final calculation. The syntax is:
=LET(name1, value1, [name2, value2, …], calculation)
The last argument is the calculation that gives the result. Each name exists only inside that one formula, so it doesn’t clash with names used elsewhere in the workbook.
LET works in Excel for Microsoft 365, Excel 2021 and Excel for the web.
A simple example
Say B2 holds a unit price, C2 holds a quantity, and D2 holds a tax rate. Without LET, the total looks like this:
=B2C2+B2C2*D2
With LET, the same total is:
=LET(subtotal, B2C2, tax_amount, subtotalD2, subtotal+tax_amount)
Both formulas give the same answer. The LET version says what each part is, so the next person who reads it can follow the logic.
Naming rules
- A name must start with a letter or an underscore.
- After that, use letters, numbers, periods or underscores. Don’t use spaces.
- A name can’t look like a cell reference. Names such as A1 or TAX2024 are rejected, because Excel reads them as cell addresses.
- Names aren’t case-sensitive, so Total and total are the same name.
Descriptive names such as unit_price or tax_amount are easier to read than short names such as x or a1.
A longer example
Suppose column A holds the status of each order and column B holds the amount. To add up the amounts marked Paid:
=LET(status, A2:A100, amount, B2:B100, SUM(FILTER(amount, status=“Paid”)))
The status and amount names make it clear what each range holds. The FILTER does the selection, and SUM adds up the result.
Where LET helps most
- Formulas that repeat the same expression several times.
- Formulas that someone else will read or edit.
- Building a formula step by step. Use Evaluate Formula to check each part as you go. The steps are in how to use evaluate formula in excel.
Common errors
- #NAME? usually means a name is misspelled, or it was used outside the LET formula where it was defined. For other causes of this error, see why does excel show #name error.
- An invalid name is refused by Excel if the name has a space or looks like a cell reference. Rename it with an underscore or a different word.
- A missing calculation means the formula ends on a name or a value. A LET formula must finish with a calculation that uses the names.
Older Excel versions
Excel 2019 and earlier don’t have LET. A workbook that uses LET opened in an older version can’t calculate it and shows #NAME? errors when the cells recalculate. If the workbook has to work in older versions, use the plain formula instead.