LET: naming a step in a long formula
=LET(total,SUM(B2:B13),IF(total>=F1,total*5%,0)) adds up B2:B13 once, calls the answer total, then uses total twice. LET is in Excel for Microsoft 365 (Windows and Mac), Excel 2021 and 2024, and Excel for the web, and Google Sheets has it too. It gives part of a formula a name, so a long formula works something out once and reads more like a sentence.
LET at a glance
| You want | Formula | What you get |
|---|---|---|
| Work something out once, use it twice | =LET(total,SUM(B2:B5),IF(total>=F1,total*5%,0)) | A 5% bonus if the total reaches the target |
| Steps with names | =LET(net,B2*C2,vat,net*20%,net+vat) | A price with VAT, each step named |
| A name for a list | =LET(s,B2:B7,FILTER(A2:A7,s>AVERAGE(s))) | Everyone above the average |
| Text in pieces | =LET(p,TEXTSPLIT(A2," "),INDEX(p,2)&", "&INDEX(p,1)) | Amira Khan turned into Khan, Amira |
Each one is worked through below.
Why bother?
Four months of sales are in B2:B5, and the target is in F1. The bonus is 5% of the total, but only if the total reaches the target. Without LET you need SUM twice:
=IF(SUM(B2:B5)>=F1,SUM(B2:B5)*5%,0)
That's long, and if the range changes you have to change it in two places. With LET, you name the total once:
=LET(total,SUM(B2:B5),IF(total>=F1,total*5%,0))
The four months come to 2,400 + 2,950 + 3,100 + 2,700 = £11,150. That's over the £10,000 target, so the bonus is 5% of £11,150, which is £557.50.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Month | Sales | Target | £10,000.00 | ||
| 2 | Apr | £2,400.00 | With LET | £557.50 | ||
| 3 | May | £2,950.00 | Without LET | £557.50 | ||
| 4 | Jun | £3,100.00 | ||||
| 5 | Jul | £2,700.00 |
Excel works the total out once, too. On a big sheet with long formulas, that can make it calculate faster.
How LET is put together
LET always comes in pairs, then one last part:
- A name:
total. Use a word that starts with a letter, with no spaces. Avoid anything that looks like a cell, such as B1. - What it stands for:
SUM(B2:B5). - As many more pairs as you like.
- Last, the answer, which can use any of the names.
A small example to see it work: =LET(x,5,x*x+1). x is 5, so the answer is 5 × 5 + 1 = 26.
Several names, one after another
Each name can use the ones before it. An order is 12 boxes at £4.50 each. That's 12 × 4.50 = £54 before VAT, VAT at 20% is £10.80, and the total is 54 + 10.80 = £64.80. With a name for each step:
=LET(net,B2*C2,vat,net*20%,net+vat)
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Item | Boxes | Price each | Total with VAT |
| 2 | Labels | 12 | £4.50 | £64.80 |
| 3 | Folders | 5 | £8.20 | £49.20 |
| 4 | Pens | 30 | £1.15 | £41.40 |
Anyone reading the formula can see what each step is. The same idea tidies a timesheet: hours worked names a night shift's hours before taking off the break. That matters most in a workbook someone else will pick up. There's more on the sum itself in the VAT formula.
A name for a list
A name can stand for a whole range, and the answer can spill. Who sold more than the average? The six sales average £4,083.33, and Amira (£4,200), Cara (£5,600) and Ewa (£4,900) are above it.
=LET(s,B2:B7,FILTER(A2:A7,s>AVERAGE(s)))
| A | B | C | D | |
|---|---|---|---|---|
| 1 | Name | Sales | Above average | |
| 2 | Amira Khan | £4,200.00 | Amira Khan | |
| 3 | Ben Lewis | £3,100.00 | Cara Jones | |
| 4 | Cara Jones | £5,600.00 | Ewa Nowak | |
| 5 | Dev Patel | £2,800.00 | ||
| 6 | Ewa Nowak | £4,900.00 | ||
| 7 | Finn Walsh | £3,900.00 |
Point s at a longer range and both the test and the average follow. A name can hold a stacked list too, such as two teams joined with VSTACK: =LET(all,VSTACK(A2:B4,D2:E4),SORT(all,2,-1)). There's more on FILTER in UNIQUE and FILTER, and on spilled lists in SORT and SORTBY.
Text in pieces
To turn Amira Khan round into Khan, Amira, split it at the space once and name the pieces:
=LET(p,TEXTSPLIT(A2," "),first,INDEX(p,1),last,INDEX(p,2),last&", "&first)
| A | B | |
|---|---|---|
| 1 | Name | Surname first |
| 2 | Amira Khan | Khan, Amira |
| 3 | Ben Lewis | Lewis, Ben |
| 4 | Cara Jones | Jones, Cara |
p holds the two pieces from TEXTSPLIT. first uses p to get Amira, and last uses p to get Khan. The answer puts them back together the other way round.
Checking a LET formula
To see what one name holds, put it as the last part for a moment: =LET(total,SUM(B2:B5),total) shows the total on its own. When it looks right, put the real answer back.
Common mistakes
A name that looks like a cell
Names like a1 or tax2 look like cell addresses, and Excel won't accept them. Use words: total, rate, pieces.
No answer at the end
Every name needs a value, and the last part is the answer. =LET(total,SUM(B2:B13)) has a name and a value but no answer, so Excel won't take it.
Using a name before it's made
Names are made in order. =LET(vat,net*20%,net,B2*C2,net+vat) fails because vat uses net before net exists. Put net first.
#NAME? in older Excel
LET isn't in Excel 2019 or older. The formula has to be written out in full there, as in the "without LET" version above.
Try it now
The bonus is 5% of the year's total sales, but only if the total reaches the target in F1. Otherwise it's 0. In F2, use LET to name the total once, then use the name in an IF.
| A | B | C | D | E | F | |
|---|---|---|---|---|---|---|
| 1 | Month | Sales | Target | £34,300.00 | ||
| 2 | Apr | £2,400.00 | Bonus | |||
| 3 | May | £2,950.00 | ||||
| 4 | Jun | £3,100.00 | ||||
| 5 | Jul | £2,700.00 | ||||
| 6 | Aug | £2,250.00 | ||||
| 7 | Sep | £3,400.00 | ||||
| 8 | Oct | £2,800.00 | ||||
| 9 | Nov | £3,050.00 | ||||
| 10 | Dec | £3,600.00 | ||||
| 11 | Jan | £2,100.00 | ||||
| 12 | Feb | £2,650.00 | ||||
| 13 | Mar | £3,300.00 |
Open this in Try a formula: the same sheet with the answer filled in, to change or share by link.
Part of Excel data cleaning practice: every lesson on the topic, with a project in Excel.
Where it works
LET is in Excel for Microsoft 365 on Windows and Mac, Excel 2021 and 2024, Excel for the web, and Google Sheets. Excel 2019 and older show #NAME?.
Questions
What does LET do in Excel?
LET gives a part of a formula a name, then uses the name in the rest of it. =LET(total,SUM(B2:B13),IF(total>=F1,total*5%,0)) works out the total once, calls it total, and uses it twice. The formula is shorter, the range is typed once, and anyone reading it can see what each part is. The answer is the same as the formula written out in full.
Does LET make Excel calculate faster?
It can. Without LET, a formula that uses SUM(B2:B13) twice works the sum out twice. With LET, it's worked out once and the answer is used again. On a small sheet you won't notice. On a big one, with long formulas copied down thousands of rows, especially ones with FILTER or a lookup inside, it can make a real difference.
What names can I use in LET?
Use a word that starts with a letter and has no spaces, such as total, rate or net_pay. Avoid anything that looks like a cell address, such as a1 or tax2, because Excel reads those as cells and won't accept the formula. Names only last inside the one formula, so the same name can be used again in the next cell without any clash.
Can I use LET in older Excel or Google Sheets?
Google Sheets has LET, and it works the same way. In Excel you need Microsoft 365, Excel 2021 or 2024, or Excel for the web. Excel 2019 and older show #NAME?. If a file has to work there, write the formula out in full, or work the step out in a helper column and point at that cell instead.