Excel functions · Logic
LET function in Excel
LET assigns names to values or calculations inside a formula and then uses those names in a final calculation, so a long formula is easier to read and each part is calculated once. =LET(x, 5, x*2) returns 10.
Last reviewed
Syntax
=LET(name1, name_value1, [name2, name_value2, ...], calculation)- name1required
- A name for the first value. It must start with a letter and can't look like a cell reference such as A1.
- name_value1required
- The value or calculation the name stands for.
- name2, name_value2, ...optional
- More name and value pairs. Later values can use earlier names.
- calculationrequired
- The last argument: the result, written with the names.
- Names live only inside that formula; they don't appear in Name Manager.
- A value used three times is calculated once, which can speed up heavy formulas.
Which versions have LET
Microsoft 365, Excel for the web, and Excel 2021 or later (Windows and Mac). Not in Excel 2019 or 2016.
| Version | Has it |
|---|---|
| Microsoft 365 (Windows and Mac) | Yes |
| Excel for the web | Yes |
| Excel 2024 | Yes |
| Excel 2021 | Yes |
| Excel 2019 | No |
| Excel 2016 | No |
Google Sheets
Google Sheets has LET with the same arguments.
Examples
The examples use this sample sheet.
| Row | A | B | C | D | E |
|---|---|---|---|---|---|
| 1 | Order ID | Rep | Region | Product | Amount |
| 2 | 1001 | Ana | North | Laptop | 1200 |
| 3 | 1002 | Ben | South | Monitor | 300 |
| 4 | 1003 | Ana | North | Monitor | 350 |
| 5 | 1004 | Cara | East | Laptop | 1150 |
| 6 | 1005 | Ben | South | Laptop | 1250 |
| 7 | 1006 | Dev | West | Keyboard | 80 |
| 8 | 1007 | Cara | East | Monitor | 320 |
| 9 | 1008 | Ana | South | Keyboard | 90 |
1.Share of total
=LET(total, SUM(E2:E9), south, SUMIFS(E2:E9, C2:C9, "South"), south/total)Result: 0.346 (34.6% as a percentage)
1,640 of 4,740. Each part has a name, so the final step reads like a sentence.
2.Name a constant
=LET(price, 1250, tax, 8%, price + price*tax)Result: 1350
1,250 plus 8% tax (100).
3.Reuse a calculated value
=LET(avg, AVERAGE(E2:E9), COUNTIF(E2:E9, ">"&avg))Result: 3
The average order is 592.50; three orders (1,200, 1,150 and 1,250) are above it.
Common errors and fixes
| Error | Why it happens | Fix |
|---|---|---|
| #NAME? | A name is used before it's defined or is misspelled, or your Excel doesn't have LET (2019 or older). | Check that every name is defined earlier in the same LET, and use Microsoft 365 or Excel 2021 or later. |
Do it with GPTExcel
Skip writing LET by hand
Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.
Rewrite this long formula with LET so each step has a readable name.
Done. I used LET on your sheet and checked the results against your data.
- Written for your platform and version
- Checked against your actual data
- Newest functions looked up in official docs
LET questions
- Why use LET in Excel?
- It makes long formulas readable by naming each step, and a named value is calculated once even if the formula uses it several times.
- What's the difference between LET and LAMBDA?
- LET names values inside one formula. LAMBDA turns a formula into a reusable function with parameters that you can name in Name Manager and call like a built-in function.
Skip the formula hunt
Upload a spreadsheet and ask in plain English. Free plan, no credit card.
Start free