Logical
LET Function in Excel
Assigns names to calculation results, allowing you to store intermediate calculations and reuse them.
Syntax
- =LET(name1, value1, [name2], [value2], ..., calculation)
Arguments
- name1 (required): First variable name
- value1 (required): Value for first variable
- calculation (required): Final calculation using the variables
Examples
- =LET(x, 10, y, 20, x+y) - Simple variables - Result: 30
- =LET(data, A1:A100, avg, AVERAGE(data), COUNTIF(data, ">"&avg)) - Complex calculation - Result: Count above average
Excel LET function documentation
- LET assigns names to calculation results inside a single formula — improves readability and can improve performance.
- Syntax: =LET(name1, value1, [name2, value2], …, calculation). Microsoft 365 / Excel 2021+.
- Variables exist only within that formula — not workbook-wide like named ranges.
- Related: [LAMBDA](/functions/lambda/), [IF](/functions/if/), [XLOOKUP](/functions/xlookup/).
LET syntax and naming rules
- Pairs of name, value — then final argument is the expression using those names.
- Names must not conflict with function names or structured table references.
- Inner LET can nest — each LET scope is local to its formula.
- Excel calculates named values once per recalc — reuse expensive XLOOKUP inside LET.
Step-by-step: LET with repeated lookup
- Step 1 — Slow sheet repeats =XLOOKUP(A2, big_table[col1], big_table[col2]) twice per row.
- Step 2 — =LET(lu, XLOOKUP(A2, ids, prices), IF(lu>100, lu*0.9, lu)).
- Step 3 — XLOOKUP runs once; lu reused in IF.
- Step 4 — Add second name: =LET(lu, XLOOKUP(...), tax, lu*0.08, lu+tax).
- Step 5 — Compare calc time on large models with Performance Analyzer.
LET vs named ranges vs LAMBDA
- LET — local to one formula; great for intermediate steps.
- Named range — workbook scope; good for global constants.
- LAMBDA — reusable custom function; often defined with LET inside.
- Readability: break monster nested IF into LET variables with clear names.
Worked examples to copy
- Tax-included price: =LET(base, B2*C2, base*(1+tax_rate)).
- Margin: =LET(rev, SUM(Table[Rev]), cost, SUM(Table[Cost]), (rev-cost)/rev).
- Safe lookup: =LET(x, XLOOKUP(A2, keys, vals, "Missing"), x).
- Nested: =LET(a, 1, b, 2, LET(c, a+b, c*10)).
People also ask
- LET improve performance? — Yes when same subexpression repeated many times.
- LET in Excel 2019? — Not available; M365 / 2021+.
- LET vs define name? — LET is formula-local and temporary.
- How many variables in LET? — Up to 126 pairs in supported builds.
Common errors
- Variable names cannot be cell references
Use cases
- Simplify complex formulas
- Improve performance
- Readable formulas
Frequently asked questions
- Why should I use LET instead of repeating calculations? LET improves performance by calculating a value once and reusing it. Without LET, =IF(VLOOKUP(...)>0, VLOOKUP(...)*2, 0) runs VLOOKUP twice. With LET: =LET(v, VLOOKUP(...), IF(v>0, v*2, 0)) runs it once. Also makes formulas more readable.
- Can I nest LET functions? You don't need to nest - just add more name/value pairs: =LET(a, 1, b, 2, c, a+b, c*2). Each variable can reference previous ones. The last argument is always the final calculation that uses the variables.
- What are valid variable names in LET? Variable names must start with a letter, can contain letters, numbers, underscores, and periods. Cannot be cell references (A1), function names (SUM), or reserved words (TRUE). Good names: total, avg_sales, item_count.
Editorial review
- Reviewed by Excel.Directory Editorial Team. Updated May 2026.
When to use LET
- Simplify complex formulas — common Logical scenario for LET.
- Improve performance — common Logical scenario for LET.
- Readable formulas — common Logical scenario for LET.
LET in the Logical category
- Browse all Logical functions at /categories/logical/ for related formulas.
- LET syntax: =LET(name1, value1, [name2], [value2], ..., calculation)
- name1 (required): First variable name
- value1 (required): Value for first variable
- calculation (required): Final calculation using the variables
- Confirm LET arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
Formula checklist before you copy down
- Confirm LET arguments match the syntax shown above before filling down.
- Lock table and range references with $ when copying formulas across rows or sheets.
- If results look wrong, check for text stored as numbers and invisible spaces with TRIM.
- Spot-check three known input rows manually against expected output.
Related Excel functions
- LAMBDA (/functions/lambda/): Creates custom, reusable functions that can be called by a friendly name.
- IF (/functions/if/): Returns one value if a condition is TRUE and another value if it's FALSE.
Errors to watch for
- Variable names cannot be cell references — review causes on linked error pages in the directory.
Copy-paste audit workflow
- Enter LET on three test rows with known expected output documented on a QA tab.
- Fill down only after absolute references are locked on lookup tables and rate tables.
- Compare against manual calculation or a calculator for financial and statistical functions.
- Search this directory for comparison guides when choosing between similar functions in the same category.
LET worked examples to copy
- =LET(x, 10, y, 20, x+y) — Simple variables. Expected result: 30.
- =LET(data, A1:A100, avg, AVERAGE(data), COUNTIF(data, ">"&avg)) — Complex calculation. Expected result: Count above average.
LET reference summary for crawlers and offline review
- LET belongs to the Logical category in Excel. Assigns names to calculation results, allowing you to store intermediate calculations and reuse them.
- Full syntax: =LET(name1, value1, [name2], [value2], ..., calculation). Open /functions/let/ for parameters, FAQs, and related pages.
- Common mistakes: Variable names cannot be cell references
- Pair this function with comparison guides when another Excel formula might fit the same task better.
- Review fix-excel-formula-errors when unexpected errors appear after upgrading Excel or sharing across locales.