LET function
Gives names to values or calculations inside one formula, so long formulas are easier to read and repeated parts are calculated only once.
Available in Microsoft 365, Excel 2021 and later, Excel for the web
Excel 2021 and laterWorks in Google Sheets
Syntax
LET(name1, value1, [name2, value2, ...], calculation)| Argument | What it means | |
|---|---|---|
name1 | Required | The first name to define. It must start with a letter and must not look like a cell reference. |
value1 | Required | The value, range or formula assigned to name1. |
name2, value2, ... | Optional | More name/value pairs. Each can use the names defined before it. |
calculation | Required | The final formula, which can use all the names. It is always the last argument. |
Returns: The result of calculation.
How LET works
LET works like variables in a programming language, but inside a single cell. You give a piece of the formula a name — total for SUM(B2:B5), rate for a commission percentage — and then use that name in the rest of the formula. The result is a formula that reads almost like a sentence: "let total be the sum, let tax be total times 24%, then return total plus tax".
There are two big benefits. Readability: a reviewer can see what each part means instead of decoding a wall of nested functions. Speed: when the same sub-calculation appears several times, LET computes it once and reuses the result, which matters with heavy functions such as FILTER, XLOOKUP or SUMIFS over large ranges.
Arguments come in pairs (name, value), and the last argument is the calculation. Names exist only inside that one formula; they do not appear in Name Manager and do not clash with other cells. Later names can use earlier ones, but not the other way round.
Examples
1Invoice total with VAT, step by step
| A | B | |
|---|---|---|
| 1 | Line item | Net |
| 2 | Consulting | 120 |
| 3 | Travel | 80 |
| 4 | Printing | 45.5 |
| 5 | Software | 254.5 |
| 6 | 620 |
Result: 620
total becomes 500, tax becomes 500 × 24% = 120, and the final calculation returns 620. Each step has a name you can check.
2Commission rate decided once, used once
| A | B | C | |
|---|---|---|---|
| 1 | Rep | Sales | |
| 2 | Marta | 24000 | 1920 |
| 3 | Nikos | 15500 |
Result: 1920
Marta's sales are above 20,000, so rate is 8% and the commission is 24,000 × 0.08 = 1,920. For Nikos the rate would be 5%, giving 775.
3Top performers, sorted (spilled)
| A | B | C | D | E | |
|---|---|---|---|---|---|
| 1 | Rep | Sales | |||
| 2 | Ana | 420 | Eva | 960 | |
| 3 | Ben | 780 | Ben | 780 | |
| 4 | Cleo | 515 | Cleo | 515 | |
| 5 | Dan | 300 | |||
| 6 | Eva | 960 |
data names the table, top keeps the reps with at least 500, and the final step sorts them by sales, highest first. Changing the range only means editing it in one place.
Common errors and how to fix them
| Error | Why it happens | Fix |
|---|---|---|
#NAME? | A name is invalid — for example tax1 looks fine but r1 or AB12 look like cell references, and names cannot contain spaces. | Use descriptive names such as total, rate, taxAmt. |
Error message when entering | An even number of arguments: the final calculation is missing. | Always finish with the expression that should be returned. |
Tips
- Use Alt+Enter (Mac: Ctrl+Option+Return) to put each name/value pair on its own line in the formula bar.
- To debug, temporarily change the last argument to one of the names (e.g.
..., tax)) to see the intermediate value. - LET pairs naturally with LAMBDA: define helpers with LET inside the calculation of a LAMBDA.
Questions
Are LET names visible to other cells?
No. They exist only inside the formula where they are defined. For workbook-wide names use Name Manager.
Does LET make formulas faster?
When a sub-calculation is repeated, yes: LET evaluates it once. If nothing is repeated, the gain is readability rather than speed.
Google Sheets
LET also exists in Google Sheets and works the same way for everyday use, so the examples above work there too.