Ravindra BagaleCourses & study guides Track your progress

Guides

LET Function in Excel: Name the Parts of a Long Formula

Raja's bonus formula repeats B2/C2 three times: once to check if the target is met, once for the 120% slab and once inside the result. When the rule changes, he has to edit all three places. With LET he names B2/C2 as ach once and uses the name everywhere.

LET lets you create names inside a formula: =LET(name1, value1, [name2, value2, ...], calculation). Each value is worked out once, and the last argument is the result. It needs Microsoft 365 or Excel 2021 and later.

Download the practice file (let-function.xlsx)

Excel file, 7 KB. It has the sample data used below. All numbers in this workbook are fictional teaching data, not real company figures.

Quick answer

  1. Start with =LET(.
  2. Give a name and its value: ach, B2/C2,.
  3. Add more pairs if needed: rate, IF(ach>=1.2,5%,2%),.
  4. Finish with the calculation that uses the names: IF(ach<1,0,ROUND(B2*rate,0))).
  5. Press Enter and copy down like any formula.
=LET(ach,B2/C2,rate,IF(ach>=1.2,5%,2%),IF(ach<1,0,ROUND(B2*rate,0)))

Before and after

The bonus rule: no bonus below 100% of target, 2% of sales from 100%, and 5% of sales from 120%.

Without LET:
=IF(B2/C2<1,0,ROUND(B2*IF(B2/C2>=1.2,5%,2%),0))

With LET:
=LET(ach,B2/C2,rate,IF(ach>=1.2,5%,2%),IF(ach<1,0,ROUND(B2*rate,0)))
RepSalesTargetAchievementBonus
Amir₹2,60,000₹2,20,000118%₹5,200.0
Zoya₹1,90,000₹2,00,00095%₹0
Raja₹3,10,000₹2,50,000124%₹15,500.0
Rani₹2,05,000₹2,00,000102%₹4,100.0
Salman₹1,50,000₹1,80,00083%₹0

Both formulas give the same answers; the LET version says what it means. To change the 120% slab you edit one place.

Example 2: clean a name once, use it twice

=LET(t,TRIM(A2),PROPER(t)&" ("&LEN(t)&" letters)")

TRIM(A2) runs once and is used twice. For " zoya " the result is Zoya (4 letters).

Rules for names

  • Names must start with a letter and cannot look like a cell address (ab1 is not allowed; ach is fine).
  • A name can use the names defined before it.
  • Names exist only inside that one formula; they do not appear in Name Manager.
  • Use Alt + Enter inside the formula bar to put each pair on its own line for readability.

Ravindra Bagale's Tip

Name things the way you would explain them aloud: ach, rate, target. Six months later, IF(ach<1,0,...) still makes sense; IF(B2/C2<1,0,...) needs decoding.

Practice task

  1. Open the Bonus sheet. Compare the formulas in D2 and E2.
  2. Check both columns give the same bonus for all five reps.
  3. Change the 120% slab to 115% in the LET formula (E2) and copy it down. Notice you changed one place.
  4. On the Clean sheet, check B2 shows Zoya (4 letters).
  5. Write your own LET that calculates GST once and returns price + GST.

Frequently asked questions

Which Excel versions have LET?

Microsoft 365, Excel 2021, Excel 2024 and Excel for the web.

Does LET make formulas faster?

Yes when a part is used several times, because it is calculated once instead of each time it appears.

Can LET return a spilled range?

Yes. If the final calculation returns an array, it spills like any dynamic array formula.

What is the difference between LET and LAMBDA?

LET names parts inside one formula. LAMBDA builds your own reusable function that you can name in Name Manager.