
Section: Excel & Google Sheets
The LET function in Excel lets you name a piece of a formula and reuse it. =LET(total,SUM(B2:B20),total*0.2) adds the range once, calls the result total, and works out 20 percent of it. The point is not shorter typing. It is that a long formula stops repeating the same expression three times, which makes it easier to read and faster to calculate. This guide covers the syntax, the patterns worth using, and the errors that come from badly chosen names. The sample data is made up.
What LET does
Microsoft describes LET as assigning names to calculation results, so you can store intermediate values inside a formula. The names only exist inside that formula, which is why LET does not clutter the workbook with defined names. You give it pairs of a name and a value, then finish with a calculation that uses them. At least one pair is required, and Microsoft allows up to 126 of them.
The syntax
=LET(name1, name_value1, calculation_or_name2, [name_value2, calculation_or_name3, ...])
- name1 must start with a letter and must not look like a cell reference or conflict with range syntax.
- name_value1 is what that name holds, such as a range, a number, a text string or another formula.
- The last argument must be the calculation that returns the result.
That last rule is the one people break. If the final argument is a name and value pair with nothing after it, the formula has no result to return and Excel complains.

A first example
Start small. =LET(x,5,SUM(x,1)) returns 6. The name x holds 5, and the calculation adds 1. Once that works, the pattern scales to real ranges: =LET(amounts,B2:B200,rates,C2:C200,SUMPRODUCT(amounts,rates)) gives a weighted total with the two ranges named instead of repeated.
Clean up a repeated expression
Here is the case LET was built for. Suppose you filter a sales table for one rep and want a dash wherever the result is blank. Without LET you write the filter twice:
=IF(ISBLANK(FILTER(A2:D8,A2:A8="Fred")),"-",FILTER(A2:D8,A2:A8="Fred"))
With LET you write it once:
=LET(criteria,"Fred",rows,FILTER(A2:D8,A2:A8=criteria),IF(ISBLANK(rows),"-",rows))
This example follows the repeated-FILTER pattern in Microsoft's LET documentation, and notes that the LET version computes faster. The gain is not only speed. The second version reads like a sentence: pick the criteria, get the rows, handle the blank case. That matters when someone else has to maintain the file, and it matters more when the filter is long enough that the two copies drift apart after an edit.

Name a range inside the formula
A LET name can hold a range, which is how you avoid writing the same A2:A500 four times in a lookup and a count. =LET(codes,A2:A500,COUNTIF(codes,"P-*")) is short, and changing the range means changing one line. This is a lighter option than a workbook defined name, because it stays inside the formula and is local to this formula. Deleting source data can still break the calculation.
Calculate once, not three times
Repeated expressions can cause duplicate calculation work. LET lets a repeated intermediate result be named and reused. LET stores the result once and the later arguments reuse it. On a small sheet you will not notice. On a report with thousands of rows and several such formulas, the difference in response time is real, and it is the reason LET is worth learning even if your formulas are already correct.
Combine it with other functions
LET works anywhere a formula works, so it wraps lookups, filters and error handling without any special syntax. A common pattern names the lookup result, then tests it: =LET(found,XLOOKUP(H2,$A$2:$A$200,$E$2:$E$200,""),IF(found="","Not in list",found)). Another names a filtered range and then sorts it. Our guides to FILTER and XLOOKUP cover the functions themselves; LET just makes them easier to combine.

LET compared with a helper column
The old way to break a long formula into pieces was to add helper columns: one for the cleaned text, one for the lookup, one for the final result. Helper columns are visible, easy to check and easy to sort, which is why they are still a good choice on a working sheet that other people read. LET does the same job inside one cell, so the sheet stays narrow and nothing extra is left behind when the report is printed. On a shared working file, a helper column is often clearer. On a finished report or a template, LET keeps the layout clean.
Availability
Microsoft lists LET for Excel for Microsoft 365, Excel 2024 and Excel 2021, on Windows, Mac and the web. Excel 2019 and 2016 do not have it and return #NAME?. If you share a workbook with people on older versions, the formula will not work for them, so check before you build a report around it.

Common errors
- #NAME? The version does not support LET, or a name is misspelled in the calculation.
- #VALUE! or a syntax error. The pairs are uneven, or the last argument is not a calculation.
- A name is rejected. Names must start with a letter and must not conflict with cell references. Microsoft gives the example that "a" is valid but "c" is not, because c clashes with R1C1 style references.
- The result is wrong, not broken. A name was reused for two different values. Use one name per idea.
- Someone else cannot follow it. Use words, not single letters. rows, amounts and rate read better than a, b and c.
Questions and answers
Does LET change the workbook?
No. The names exist only inside the formula that defines them.
Can I use LET in Google Sheets?
Google Sheets has its own LET function with a similar idea, so the pattern carries over, but check the syntax on Google's function page before copying a formula across.
Is LET the same as a named range?
No. A named range lives in the workbook and is visible everywhere. A LET name lives inside one formula.
How many names can I use?
Up to 126 name and value pairs, according to Microsoft's documentation.
Should I use LET or LAMBDA?
Use LET to tidy one formula. Use LAMBDA when you want to create a reusable function with its own name that other cells can call.
