Mastering Variables in Google Sheets: A Guide to the LET Function
July 18th, 2026
Long formulas usually go wrong in one of two ways: they repeat the same sub-expression five times, or they become unreadable the moment someone else (including future you) tries to edit them. LET fixes both problems by letting you name a value once inside a formula and reuse that name — no helper columns, no repeated lookups.
The basic idea
LET takes pairs of name, value_expression, followed by a final formula_expression that uses those names.
=LET(a, 5, a + 3)
This assigns 5 to a, then evaluates a + 3, returning 8. You can chain multiple assignments, and later ones can reference earlier ones:
=LET(a, 10, b, a * 2, c, a + b, c ^ 2)
Here a is 10, b is 20 (a * 2), c is 30 (a + b), and the formula returns c ^ 2, or 900.
Why bother: avoiding repeated work
The real payoff shows up when a formula would otherwise reference the same expensive calculation more than once. Take a typical VLOOKUP-with-a-fallback pattern:
=IF(VLOOKUP(A2, B:C, 2, FALSE) = "", "N/A", VLOOKUP(A2, B:C, 2, FALSE))
That's the same VLOOKUP evaluated twice — Sheets has to look up A2 in B:C once to check the condition, then a second time to return the value. With LET, it runs once:
=LET(result, VLOOKUP(A2, B:C, 2, FALSE), IF(result = "", "N/A", result))
Same output, half the lookups. On a small range you won't notice; on thousands of rows of XLOOKUP or nested IFS, this matters.
Why bother: naming things for clarity
LET is just as useful when performance isn't the issue and readability is. Compare:
=(B2-A2)*24
to:
=LET(hours, (B2 - A2) * 24, hours)
That example is trivial on its own, but scale it up to a formula with several intermediate steps — say, computing a discounted total from a price, a quantity, and a tax rate — and naming each step turns a wall of nested parentheses into something you can read top to bottom:
=LET(
price, A2,
qty, B2,
tax, 0.2,
subtotal, price * qty,
subtotal * (1 + tax)
)
Each name documents what that piece of the formula means, which is especially useful when someone else opens the sheet later.
LET inside array formulas
LET works over arrays too, which pairs well with functions like FILTER or ARRAYFORMULA where you'd otherwise recompute the same filtered range multiple times:
=LET(
matches, FILTER(A2:A100, B2:B100 = "Active"),
IF(COUNTA(matches) = 0, "No results", matches)
)
matches is computed once and reused both to check whether anything came back and to return the values themselves.
When to reach for LET
- A sub-expression (a lookup, a filter, a calculation) appears more than once in the same formula.
- A formula has several logical steps and naming them would make it easier to audit or debug.
- You're building a formula you expect to hand off or revisit later — named variables document intent better than bare cell references.
If a formula is already a single short expression, LET just adds ceremony — save it for formulas where repetition or complexity actually justifies it.