Excel functions · Logic

LET function in Excel

LET assigns names to values or calculations inside a formula and then uses those names in a final calculation, so a long formula is easier to read and each part is calculated once. =LET(x, 5, x*2) returns 10.

Last reviewed

Syntax

=LET(name1, name_value1, [name2, name_value2, ...], calculation)
name1required
A name for the first value. It must start with a letter and can't look like a cell reference such as A1.
name_value1required
The value or calculation the name stands for.
name2, name_value2, ...optional
More name and value pairs. Later values can use earlier names.
calculationrequired
The last argument: the result, written with the names.
  • Names live only inside that formula; they don't appear in Name Manager.
  • A value used three times is calculated once, which can speed up heavy formulas.

Which versions have LET

Microsoft 365, Excel for the web, and Excel 2021 or later (Windows and Mac). Not in Excel 2019 or 2016.

LET availability by Excel version
VersionHas it
Microsoft 365 (Windows and Mac)Yes
Excel for the webYes
Excel 2024Yes
Excel 2021Yes
Excel 2019No
Excel 2016No

Google Sheets

Google Sheets has LET with the same arguments.

Examples

The examples use this sample sheet.

Orders (A1:E9)
RowABCDE
1Order IDRepRegionProductAmount
21001AnaNorthLaptop1200
31002BenSouthMonitor300
41003AnaNorthMonitor350
51004CaraEastLaptop1150
61005BenSouthLaptop1250
71006DevWestKeyboard80
81007CaraEastMonitor320
91008AnaSouthKeyboard90
  1. 1.Share of total

    =LET(total, SUM(E2:E9), south, SUMIFS(E2:E9, C2:C9, "South"), south/total)

    Result: 0.346 (34.6% as a percentage)

    1,640 of 4,740. Each part has a name, so the final step reads like a sentence.

  2. 2.Name a constant

    =LET(price, 1250, tax, 8%, price + price*tax)

    Result: 1350

    1,250 plus 8% tax (100).

  3. 3.Reuse a calculated value

    =LET(avg, AVERAGE(E2:E9), COUNTIF(E2:E9, ">"&avg))

    Result: 3

    The average order is 592.50; three orders (1,200, 1,150 and 1,250) are above it.

Common errors and fixes

LET errors, causes and fixes
ErrorWhy it happensFix
#NAME?A name is used before it's defined or is misspelled, or your Excel doesn't have LET (2019 or older).Check that every name is defined earlier in the same LET, and use Microsoft 365 or Excel 2021 or later.

Do it with GPTExcel

Skip writing LET by hand

Upload your Excel or CSV file to Chat and ask in plain English. GPTExcel writes the formula for your file and your version of Excel or Google Sheets.

your-file.xlsx

Rewrite this long formula with LET so each step has a readable name.

Done. I used LET on your sheet and checked the results against your data.

your-file-updated.xlsxYour original stays unchanged
  • Written for your platform and version
  • Checked against your actual data
  • Newest functions looked up in official docs
Try it free Formula Generator

Free plan, no credit card.

LET questions

Why use LET in Excel?
It makes long formulas readable by naming each step, and a named value is calculated once even if the formula uses it several times.
What's the difference between LET and LAMBDA?
LET names values inside one formula. LAMBDA turns a formula into a reusable function with parameters that you can name in Name Manager and call like a built-in function.

Skip the formula hunt

Upload a spreadsheet and ask in plain English. Free plan, no credit card.

Start free