LET Function in Excel: name parts of a formula
Microsoft 365 and Excel 2021+.
Syntax
=LET(name1, value1, [name2, value2, ...], calculation)
Pairs of name and value, then one final calculation that uses the names.
Simple example
=LET(total,A2*B2, total+total*18%)
total is worked out once and used twice.
Before and after
Without LET, the lookup runs twice:
=IF(XLOOKUP(E2,A:A,C:C)>500,XLOOKUP(E2,A:A,C:C)*0.9,XLOOKUP(E2,A:A,C:C))
With LET, once:
=LET(price,XLOOKUP(E2,A:A,C:C), IF(price>500,price*0.9,price))
Several names
=LET(sales,B2:B100, region,A2:A100,
north,SUM(FILTER(sales,region="North")),
north/SUM(sales))
North’s share of total sales. Alt+Enter adds the line breaks in the formula bar.
Naming rules
- Start with a letter; no spaces.
- Don’t use names that look like cells (A1, tax1).
- Names exist only inside that formula.
Why bother
Faster (each part calculates once), easier to read, easier to fix. Pair it with FILTER and XLOOKUP.
For names used across the workbook: named ranges.