Logic and errors function
LET function in Google Sheets and Excel
LET gives names to parts of a formula, so each part is calculated once and the formula reads clearly.
Checked against Microsoft's and Google's documentation on · Example calculated on a live sheet
- Excel 2016
- Excel 2019
- Excel 2021
- Excel 2024
- Microsoft 365
- Google Sheets
Syntax
LET(name1, name_value1, calculation_or_name2, [name_value2, calculation_or_name3], …)Arguments in [brackets] are optional. Google Sheets writes it LET(name1, value_expression1, [name2, …], [value_expression2, …], formula_expression ).
Example
=LET(total,F2*G2,tax,total*$L$1,total+tax) reads: Call the order total F2*G2 total, call 8% of it (the rate in L1) tax, and return total + tax.
| A | B | C | D | E | F | G | H | I | J | K | L | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | Order | Date | Customer | Product | Category | Qty | Price | Status | With tax | Tax rate | 8% | |
| 2 | 1001 | 2 Mar 2026 | Mara Okafor | Monstera | Plants | 1 | $34.00 | Shipped | $36.72 | |||
| 3 | 1002 | 2 Mar 2026 | Jonas Lind | Terracotta pot | Pots | 3 | $12.50 | Shipped | $40.50 | |||
| 4 | 1003 | 3 Mar 2026 | Priya Raman | Snake plant | Plants | 2 | $22.00 | Shipped | $47.52 | |||
| 5 | 1004 | 4 Mar 2026 | Tomás Ruiz | Watering can | Tools | 1 | $18.00 | Pending | $19.44 | |||
| 6 | 1005 | 5 Mar 2026 | Elif Demir | Fern | Plants | 4 | $9.50 | Shipped | $41.04 | |||
| 7 | 1006 | 5 Mar 2026 | Mara Okafor | Potting mix | Soil | 2 | $7.25 | Returned | $15.66 | |||
| 8 | 1007 | 6 Mar 2026 | Kenji Mori | Pruning shears | Tools | 1 | $24.00 | Shipped | $25.92 | |||
| 9 | 1008 | 7 Mar 2026 | Ines Varga | Ceramic pot | Pots | 2 | $19.00 | Pending | $41.04 | |||
| 10 | 1009 | 8 Mar 2026 | Jonas Lind | Monstera | Plants | 1 | $34.00 | Shipped | $36.72 | |||
| 11 | 1010 | 9 Mar 2026 | Sofia Rossi | Fern | Plants | 6 | $9.50 | Shipped | $61.56 | |||
| 12 | 1011 | 10 Mar 2026 | Priya Raman | Potting mix | Soil | 5 | $7.25 | Shipped | $39.15 | |||
| 13 | 1012 | 11 Mar 2026 | Leo Brandt | Snake plant | Plants | 1 | $22.00 | Pending | $23.76 |
I2 shows $36.72: total is 1 × $34, tax is 8% of it, and total + tax is $36.72.
How the spreadsheet calculates it
Names parts of the formula (TOTAL = F2 times G2; TAX = TOTAL times $L$1), then works out TOTAL plus TAX.
- 1. LET: Names parts of the formula (
TOTAL=F2timesG2;TAX=TOTALtimes$L$1), then works outTOTALplusTAX.name=`TOTAL`: a word for the valuevalue=`F2*G2`: what the name stands for. Add more name/value pairs as neededcalculation=`TAX`: the final formula, using the namesvalue2=`TOTAL*$L$1`: what the name stands for. Add more name/value pairs as needed…=`TOTAL+TAX`:
More LET examples
=LET(total,F2*G2,IF(total>=50,total,total+4.95))Free shipping over 50: the total is calculated once.=LET(total,F2*G2,tax,total*$L$1,total+tax)Total plus tax, each named.=LET(x,XLOOKUP(A2,$G$2:$G$8,$I$2:$I$8),IF(x>20,"High","Low"))A lookup used once, tested by name.
Paste any of these into the formula explainer to see it step by step.
Tips
- Pick names that say what the value is (total, tax, rate) and can't be mistaken for a cell address.
- Name anything you use twice; it's calculated once.
- Build a long LET up one name at a time and check the result after each step.
- Keep settings like rates in cells and name the cell reference inside LET, so the formula reads clearly and the rate stays editable.
What LET is used for
Tidying long formulas in shared models, avoiding repeated lookups or totals inside one formula, and making a formula's logic readable months later.
Arguments
| Argument | Required | What it is |
|---|---|---|
| name1 | Yes | A name for the first value, such as total. It can't look like a cell address. |
| name_value1 | Yes | The value or calculation the name stands for. |
| calculation_or_name2 | Yes | Either the final calculation, using the names, or another name. |
| name_value2, … | No | More name and value pairs; the last argument is always the calculation. |
Common mistakes
A name that looks like a cell (
q3): it's read as a reference.Forgetting the final calculation: LET needs an odd number of arguments.
Names that look like cell addresses, such as q3 or tax1.
An even number of arguments: LET always ends with the calculation.
In Google Sheets
Google Sheets has LET with the same arguments.
Errors you may see with LET
- #NAME?: A name is misspelled in the calculation, or the file is open in Excel 2019 or older.
Questions
Does LET make formulas faster?
When a part is used more than once, LET calculates it once instead of every time it appears.
Which versions have LET?
Excel 2021, Excel 2024, Microsoft 365 and Google Sheets. See the LET guide.
Can LET names be used in other cells?
No, they exist only inside that formula. For a name the whole workbook can use, define it in the Name Manager (or Named ranges in Google Sheets).
Sources
Official documentation the facts on this page were checked against.