
π This article includes 1 downloadable practice file β
LET gives names to pieces of a formula, inside the formula. The result is shorter, easier to check, and faster, because each piece is calculated once.
Before and after
Before: =SUMIFS(K:K,D:D,"North")/SUM(K:K)*100 - IF(SUMIFS(K:K,D:D,"North")/SUM(K:K)>0.3, 5, 0)
After: =LET(north, SUMIFS(K:K,D:D,"North"),
total, SUM(K:K),
share, north/total,
share*100 - IF(share>0.3, 5, 0))
Pattern: LET(name1, value1, name2, value2, ..., final_calculation). The last argument is always the result.
Real uses
| Task | Formula |
|---|---|
| Amount with GST from the master | =LET(amt,K2,gst,XLOOKUP(F2,Master!A:A,Master!E:E),ROUND(amt*(1+gst),2)) |
| Top rep by sales | =LET(r,UNIQUE(C2:C81),s,SUMIFS(K2:K81,C2:C81,r),INDEX(r,MATCH(MAX(s),s,0))) |
| Gap between best and worst rep | =LET(r,UNIQUE(C2:C81),s,SUMIFS(K2:K81,C2:C81,r),MAX(s)-MIN(s)) |
Debugging a LET
Change the last argument to one of the names, e.g. replace the final calculation with s, to see that intermediate result. Then put the calculation back.
Common mistakes
- Names that look like cells (
tax1,gst18) give #NAME?. Usetax_amt. - Forgetting the final calculation: an even number of arguments means the result is missing.
Practice
Download this lesson’s workbook below. Write each one without LET first, then rewrite it. Type your formula in the yellow column; the Check column turns green when the result matches, and the Answers sheet has a working formula for every task.
π Practice files for this article
- πLesson 8 practice workbookSales register + product master, 6 LET tasks.β¬ XLSX Β· 20 KB
Free to use for learning. Files with macros (.bas) are plain text β import them with Alt+F11 β File β Import File, and always test on a copy.
Stuck on a step? Ask a question and the AI answers using this article.