Complex Excel formulas often repeat the same calculation two, three, or even four times. This is wasteful — Excel recalculates each copy independently, which slows performance. Moreover, repeated sub-expressions make formulas hard to read and edit. The LET function solves both problems. It lets you assign a name to any calculation, then reuse that name throughout the formula. As a result, you get shorter, faster, and far more readable formulas.
What Does the LET Function Do?
LET works like a variable in programming. You give a name to a value or a calculation. Then you use that name inside the final part of the formula. Excel calculates the named expression only once, even if you reference it multiple times. Consequently, the formula runs faster and stays easier to maintain.
For example, imagine you need to clean a value and then test it in two different ways. Without LET, you write the TRIM expression twice. With LET, you write it once, name it, and reference the name. The final result is identical, but the formula is half the length.
What Is the LET Syntax?
LET follows a repeating name-value pattern, ending with the calculation that uses those names.
| Part | Required? | What it does |
|---|---|---|
| name1 | Required | A label you choose for the first variable. Names must start with a letter, cannot contain spaces, and must not match any cell address (e.g. A1, B2). Good names describe what the value represents — for example, tax_rate or clean_name. |
| value1 | Required | The value, range, or formula assigned to name1. This can be a cell reference, a function, a constant, or any valid Excel expression. |
| name2, value2... | Optional | Additional name-value pairs. LET supports up to 126 pairs in total. Later names can reference earlier names, which allows you to build calculations step by step. |
| calculation | Required | The final expression that produces the result. This is the last argument in LET. It uses the names defined above and returns the value that appears in the cell. |
Example 1: Eliminate a Repeated Calculation
The most immediate benefit of LET is removing duplicate sub-expressions. Below, the same TRIM(LOWER(A2)) appears twice in the original formula. With LET, you define it once as a named variable. The formula therefore becomes shorter and easier to follow.
=IF(
TRIM(LOWER(A2))="yes",
TRIM(LOWER(A2))&" confirmed",
"pending"
)
TRIM(LOWER(A2)) runs twice
=LET(
val, TRIM(LOWER(A2)),
IF(val="yes",
val&" confirmed",
"pending")
)
val. Both references to val in the IF use the same cached result. The formula is shorter and runs faster.
Example 2: Multi-Step Calculation with Named Stages
LET is particularly useful when a calculation has several intermediate steps. Instead of nesting everything deeply, you break it into named stages. Each stage can reference the previous one. This approach makes the formula behave more like a set of written instructions.
tax is defined as gross * C2, and gross was defined in the line above. This chaining means each variable builds on the previous one — exactly like steps in a calculation walkthrough.
Example 3: Simplify a Long SUMPRODUCT Formula
SUMPRODUCT formulas can grow very long when they reference the same ranges multiple times. LET solves this by naming the ranges once at the top. Furthermore, anyone editing the formula later can immediately see what each range represents, which reduces the chance of mistakes.
=SUMPRODUCT(
(A2:A100="East")*
(B2:B100="Gadget")*
(C2:C100>=1000)*
D2:D100)
=LET(
region, A2:A100,
product, B2:B100,
qty, C2:C100,
revenue, D2:D100,
SUMPRODUCT(
(region="East")*
(product="Gadget")*
(qty>=1000)*
revenue))
Example 4: Conditional Logic Made Readable
Nested IF formulas are notoriously difficult to read. LET helps by naming the conditions separately before the IF. This way, the IF itself reads almost like plain English. Additionally, you can reuse the same condition in multiple places without rewriting it.
rate is defined using is_gold and is_silver, which were defined earlier. LET evaluates names in order from top to bottom, so each name can depend on any name defined before it.
Example 5: LET with Dynamic Array Functions
LET pairs naturally with dynamic array functions like FILTER, SORT, and UNIQUE. When you filter data and then sort the result, you often reference the same FILTER expression twice. LET eliminates the duplication. Moreover, if the filter criteria change, you update only one place.
filtered. Both SORT and ROWS reference the stored result. This is especially useful for large datasets where FILTER is expensive to recalculate repeatedly.
Example 6: Debug Complex Formulas Step by Step
LET is an excellent debugging tool. You can name each stage of a complex formula and temporarily return an intermediate name instead of the final result. This lets you inspect what each part produces before combining everything. Consequently, tracking down errors in long formulas becomes much faster.
base, tax_amt, discount, and final to inspect each stage. This technique replaces the slow process of manually selecting formula fragments and pressing F9 to evaluate them.
How to Fix Common LET Errors
#NAME? error
This usually means you are on Excel 2019 or earlier. LET is only available in Microsoft 365 and Excel 2021. Alternatively, the error can occur when a variable name clashes with an Excel function name or a cell address. Rename the variable to something descriptive and unique.
Circular reference warning
A variable name accidentally matches a cell address Excel recognises. For example, naming a variable C1 causes a circular reference because Excel tries to resolve it as a cell. As a result, always use descriptive names with underscores rather than short letter-number combinations.
Variable not recognised in the calculation
Variable names are only available inside the same LET formula. You cannot reference a LET variable from another cell. If you need the same named value in multiple formulas, use a named range (Formulas tab → Define Name) instead — that is the workbook-level equivalent.
Frequently Asked Questions About LET
-
What does the LET function do in Excel?+LET assigns names to calculations or values inside a formula. You define one or more name-value pairs, then use those names in the final calculation. This means Excel computes each named expression only once, even if you reference it multiple times. As a result, formulas run faster and become far easier to read and maintain.
-
Which Excel versions support LET?+LET is available in Microsoft 365 and Excel 2021 only. It is not available in Excel 2019, 2016, or any earlier version. If you open a workbook containing LET in an unsupported version, the formula returns a #NAME? error. Therefore, avoid using LET in files shared with colleagues on older Excel versions.
-
How is LET different from a named range?+Named ranges (defined through Formulas → Define Name) are available to every cell in the workbook. By contrast, LET variables exist only inside the specific formula where they are defined. Use named ranges for values you need to reference in many different formulas across a workbook. Use LET for intermediate steps within a single complex formula.
More LET Questions
-
Can a LET variable reference another LET variable?+Yes. LET evaluates name-value pairs from top to bottom. Consequently, any variable can reference a variable defined earlier in the same LET formula. For example, you can define
grossfirst, then definetaxasgross * rate. This chaining is one of LET's most powerful features for building multi-step calculations. -
Does LET always improve performance?+LET improves performance specifically when the same sub-expression appears more than once in a formula. In those cases, Excel calculates it once and reuses the stored result. However, if every sub-expression appears only once, there is no speed gain — only a readability benefit. For large datasets with repeated FILTER or SUMPRODUCT calls, the performance difference can be significant.
-
What are the naming rules for LET variables?+Variable names must start with a letter. They cannot contain spaces — use underscores instead, for example
tax_rate. They must not match any Excel function name (such as SUM or IF) or any cell address (such as A1 or B2). Beyond these restrictions, you are free to choose any descriptive name that makes the formula easier to understand.