TL;DR —
LETdeclares named variables inside one formula:=LET(name1, value1, name2, value2, …, result). The names come in pairs, the result is always the last argument, and Excel computes each named value only once — so LET is both more readable and faster than repeating a sub-expression. Excel 365 and 2021+.
=LET(revenue, B2, cost, C2, margin, (revenue-cost)/revenue, margin)
=LET(total, SUMIF(A:A,G1,B:B), IF(total>0, total, "none")) ' scans the column once, not twice
A long Excel formula is a tiny program with no variables — every value computed
inline, often more than once, and nothing with a name. LET adds the missing
first lines of that program: a place to declare your variables before you use
them. The payoff is two-for-one: a formula you can read, and one that often runs
faster.
What you'll learn
- The mental model that makes LET click: the top of a function, where you declare variables
- The one rule that breaks LET: names in pairs, calculation last — and the error you get when you miss it
- Why LET is a performance tool, not just a readability one (each value computed once)
- When to reach for LET — and the naming traps (
A1is not a valid name)
The mental model: LET is where you declare your variables
Think of the opening of any function in a real programming language: you name a
few things, then you use them. LET brings that to a cell. The shape never
changes — name/value pairs, then one final calculation that uses them:
=LET(name1, value1, name2, value2, calculation)
You read it top to bottom: "let rate be 0.2, let net be A2-B2, then return
net * rate." Once you see LET as declarations followed by a result, three
things follow:
- A name you define can be reused as often as you like in the final calculation — but Excel evaluates its value once.
- Names are built top-down: a later name can reference an earlier one, never the reverse.
- The last argument is the answer. Everything before it comes in name/value pairs.
The rule that breaks LET: pairs, then the result
This is the single most common LET error. Every argument before the last must be a name/value pair. Count them: name, value, name, value, … , result. An even number of arguments before the calculation, then one calculation to finish.
=LET(x, 10, y, 20, x+y) ' two pairs, then the result -> 30
=LET(x, 10, y, 20) ' no final calculation -> returns 20, not what you meant
=LET(x, 10, x*2, y, x+y) ' "x*2" is read as a name -> error
If your LET returns a number that looks like one of your inputs, you almost
certainly forgot the final calculation and Excel handed back your last value.
If you get #VALUE! or #NAME?, you likely put the calculation in the middle or
used an invalid name.
Naming traps:
- A name cannot look like a cell reference —
A1,R2,Q4are all rejected. Useqtr4, notQ4. - Names cannot contain spaces and cannot start with a number.
- A name can reference earlier names but not itself or a later one — declare in the order you need.
Why LET is really a performance tool
Readability is the obvious win. The hidden one is speed. Excel evaluates each named value a single time, no matter how often you reference it. Compare:
=IF(SUMIF(A:A,G1,B:B)>0, SUMIF(A:A,G1,B:B), "none")
That SUMIF over a whole column runs twice. On a big sheet with hundreds of
such formulas, that doubles the work. Wrap it once:
=LET(total, SUMIF(A:A,G1,B:B), IF(total>0, total, "none"))
Now the column scan happens once. This is the real reason power users wrap repeated sub-expressions in LET — not tidiness, but cutting recalculation in half (or more). The rule of thumb: if a sub-expression appears more than once in your formula, it belongs in a LET.
Name your steps in a dynamic-array chain
LET shines inside the modern spill formulas. Naming each stage turns an opaque nest into something you can read — and debug a line at a time:
=LET(
data, FILTER(Sales, Sales[Region]="West"),
top, SORT(data, 3, -1),
TAKE(top, 5)
)
Each name is a checkpoint: select data in the formula bar and press F9 to see
just that stage. Combined with FILTER,
SORT and TAKE,
LET is what keeps a five-step query honest.
The judgment call: LET stays in one cell — past that, you want LAMBDA
| Situation | Use | Why |
|---|---|---|
| A sub-expression repeats in one formula | LET | Computed once, not N times |
| A nested formula nobody can read | LET | Name the steps; debug each line |
| You'll reuse the logic in other cells or workbooks | LAMBDA | LET is per-formula; LAMBDA is callable |
| A trivial one-step formula | Neither | LET adds noise with no payoff |
LET lives inside one formula. The moment you want to call the same logic from
many cells — or from another workbook — you've outgrown LET and want
LAMBDA. In fact, the body of almost every good
LAMBDA is a LET. Don't reach for LET on a one-step formula either; naming =A1*2
helps no one.
How ExcelMaster helps
LET is where Excel formulas start to read like code — and code is exactly what an AI copilot is good at writing. ExcelMaster takes a long, unreadable nested formula and refactors it into a clean LET with named steps, right inside Excel — and it spots the repeated sub-expression that should only be computed once. Describe the calculation in plain English and it returns the LET, names and all. Try it on your own data.
Frequently asked questions
What does the LET function do in Excel?
LET declares named variables inside a single formula, so you can write
=LET(name, value, …, result) instead of repeating sub-expressions. It makes the
formula readable and computes each named value only once.
Why does my LET formula return the wrong value?
Almost always because the last argument is not your calculation. Everything
before the final argument must be name/value pairs; the final argument is the
result. =LET(x,10,y,20) returns 20 because there's no calculation after the
pairs.
Does LET make formulas faster?
Yes, when a sub-expression repeats. Excel evaluates each named value once, so
=LET(t, SUMIF(A:A,G1,B:B), IF(t>0,t,0)) scans the column a single time instead
of twice. On large sheets this is a real speed-up, not just cleaner text.
Why do I get a #NAME? error in LET?
You used an invalid name. Names can't look like a cell reference (A1, Q4),
can't contain spaces, and can't start with a number. Rename to qtr4, rate, or
net_sales.
Which Excel versions support LET?
LET is in Excel 2021, Excel 2024, and Microsoft 365 for Windows and Mac. It is
not available in Excel 2016 or 2019.
Tested in
Tested in: Excel 365 (Windows 11) — last verified 2026-06-22.
Related guides: Excel LAMBDA · Excel MAP, REDUCE & BYROW · Excel FILTER · Excel SORT
