Excel LET Function: Simplify Complex Formulas
In this article
The LET function in Excel lets you assign names to calculation results within a formula, so you can reuse them instead of repeating the same expression over and over. This makes long, complex formulas shorter, easier to read, and faster to calculate. You don't need any special setup—just a recent version of Excel (Microsoft 365, Excel 2021, or Excel for the web). Here's how to use it step by step.
What You'll Need
- A recent version of Excel (Microsoft 365, Excel 2021, or Excel for the web) that supports the LET function.
- A formula that has repeated parts—for example, the same calculation used multiple times in an IF or SUM.
Step-by-Step
- Identify the repeated expression. Look at your existing formula and find the part that appears more than once. For instance, in
=IF(A2>100, A2*0.1, A2*0.05), the cell referenceA2appears three times. That's a candidate for a named variable. - Start the LET function. Type
=LET(in the cell where you want the result. The syntax is:=LET(name1, value1, [name2, value2], ..., calculation). - Assign a name to the repeated part. Choose a short, meaningful name (no spaces, no special characters, not a cell reference). For example, name it
valand give it the valueA2. So you'd write=LET(val, A2, ...). - Add more names if needed. You can define multiple variables by adding name/value pairs. For example,
=LET(val, A2, taxRate, 0.1, ...). Each pair is separated by a comma. - Write the final calculation using the names. After all name/value pairs, add a comma and then the formula that uses those names. For the IF example:
=LET(val, A2, IF(val>100, val*0.1, val*0.05)). - Press Enter. Excel calculates the result. The names are only valid inside the LET function—they don't appear in the worksheet.
- Expand to more complex formulas. For a formula like
=SUM((A2:A10-5)*(B2:B10))where you want to reuseA2:A10-5, you could write=LET(adj, A2:A10-5, SUM(adj*B2:B10)). Note that LET works with arrays too.
Common Mistakes
- Using a cell reference as a name. Names like
A1orB2are not allowed because they conflict with cell references. Use names likepriceorqty. - Forgetting the final calculation. LET requires at least one name/value pair and a final calculation. If you just write
=LET(x, 5), Excel returns an error. - Using spaces or special characters in names. Names must start with a letter or underscore, and can contain letters, numbers, periods, and underscores—but no spaces or hyphens.
- Reusing the same name twice. You can't define
xtwice in the same LET. Each name must be unique.
Tips
- Use descriptive names. Instead of
a,b, use names likesubtotalordiscountto make the formula self-documenting. - Combine with other functions. LET works with any Excel function, including IF, SUM, VLOOKUP, and array formulas.
- Test with a small example first. Before rewriting a huge formula, try LET on a simple version to get the syntax right.
- Use the Formula Bar to edit. When you click a cell with a LET formula, the Formula Bar shows the full formula. You can use F9 to evaluate parts, but be careful—it replaces the selected part with the result, so press Esc to undo.
Troubleshooting
If your LET formula returns an error, check these in order:
- #NAME? error – This usually means a name is misspelled or you're using a name that Excel doesn't recognize. Check the spelling of your variable names and make sure you didn't use a cell reference.
- #VALUE! error – The calculation itself has a problem, like dividing by zero or using text in a math operation. Double-check the final calculation and the values you assigned.
- Formula doesn't update? – Make sure your workbook has automatic calculation enabled (Formulas > Calculation Options > Automatic). If not, press F9 to recalculate.
- Excel says “You've entered too many arguments” – Check that you have the correct number of commas. Each name/value pair is separated by a comma, and the final calculation is separated by a comma after the last value.
- If all else fails, simplify. Start with a single variable and add more one at a time to isolate the problem.
Frequently Asked Questions
Can I use LET in older versions of Excel?
No. LET is available in Excel 365, Excel 2021, and Excel for the web. In older versions, you'll need to use helper columns or repeat the expressions.
Does LET actually improve performance?
Yes, because Excel only calculates each named expression once. In a large workbook with many repeated calculations, this can speed up recalculations.
Can I use a name that is the same as a built-in function?
No. You cannot use names like SUM or IF because they conflict with Excel's functions. Choose different names.
Can I use LET inside another LET?
Yes, you can nest LET functions, but it's usually clearer to just define more variables in the outer LET.
Do the names appear anywhere in the worksheet?
No, they are only local to the LET function. They don't show up in the Name Manager or anywhere else.
Can I reference a cell range in a LET name?
Yes, you can assign a range like A2:A10 to a name. The name then represents that range, and you can use it in calculations that accept ranges.