Excel functions / Logical
Logical function · Excel
LET function
LET names a value or calculation inside a formula. Long formulas become easier to read and repeated work runs only once.
Arguments
| Argument | Required | Meaning |
|---|---|---|
| name1 | Yes | A name that starts with a letter. |
| value1 | Yes | The value or calculation that name stands for. |
| calculation | Yes | The final formula, which uses the names. |
Worked example
| A | B | C | |
|---|---|---|---|
| 1 | Region | Month | Sales |
| 2 | East | Jan | 1200 |
| 3 | West | Jan | 950 |
| 4 | East | Feb | 1400 |
| 5 | West | Feb | 800 |
| 6 | East | Feb | 300 |
=LET(total,SUM(C2:C6),east,SUMIF(A2:A6,"East",C2:C6),east/total)Result: 0.6237 (East share of total, 2,900 of 4,650)
The formula names the total and the East subtotal, then divides one by the other.
Try it
The practice engine does not include LET. The result shown was checked by hand and with the SUM and SUMIF parts.
Availability
| Platform | Status |
|---|---|
| Excel | Microsoft 365, Excel 2024, Excel 2021, Excel for the web. |
| Google Sheets | Available. |
Common mistakes
- The last argument must be the calculation, or the formula returns an error.
- A name cannot look like a cell reference, such as Q1.
Do it with AI
Paste this prompt into Copilot, Gemini or another assistant. Check the result on a small sample first.
Rewrite this formula with LET and clear names: =IF(SUM(C2:C6)=0,0,SUMIF(A2:A6,"East",C2:C6)/SUM(C2:C6))