LET Function

Names parts of a formula so you can reuse them and read it easily.

Category

Logical

Available in

Microsoft 365, Excel 2021+

Returns

The result of the final calculation

Taught hands-on in Level 5: Expert Techniques & Workbook Architecture - Modern Functions module

Overview

LET lets you give a calculation a name inside a formula, then use that name as many times as you like. Excel works the value out once.

Long formulas become shorter, faster and much easier to read — it's like writing your working out, line by line.

Syntax

=LET(name1, value1, [name2, value2, …], calculation)

Arguments

ArgumentRequired?What it does
name1YesA name for the first value. It must start with a letter and can't look like a cell address.
value1YesThe value or calculation that name1 stands for.
name2, value2, …OptionalMore name/value pairs. Later values can use earlier names.
calculationYesThe final formula, using the names. Always the last argument.

Examples

Example 1 — Using a total twice

Give a 5% discount when the order total is over 2,000.

D2fx=LET(total, SUM(B2:B5), IF(total>2000, total*0.95, total))
ABCD
1ItemAmountTo pay
2Desks6202194.5
3Chairs480
4Lamps500
5Shelves710
=LET(total, SUM(B2:B5), IF(total>2000, total*0.95, total)) Explain
  1. total is set to SUM(B2:B5) = 2,310.
  2. The calculation checks total>2000 — TRUE.
  3. It returns total*0.95 = 2,194.50. SUM ran only once.

Example 2 — Not repeating a lookup

Without LET you'd write the XLOOKUP twice.

=LET(price, XLOOKUP(E2, A2:A50, B2:B50, ""), IF(price="", "Missing", price*1.13)) Explain

Example 3 — Building in steps

Each name can use the ones before it.

=LET(data, A2:C100, west, FILTER(data, INDEX(data, , 2)="West"), SORT(west, 3, -1)) Explain
Press Alt+Enter between pairs in the formula bar to put each name on its own line.

Common mistakes

  • #NAME? errors. A name looks like a cell address (tax1, Q2) or is misspelt in the calculation. Use clear names like taxRate.
  • The calculation is missing. LET needs an odd number of arguments — the last one is the result.

Notes

  • Names exist only inside that one formula. For names the whole workbook can use, see Name Manager.
  • Related functions: LAMBDA, FILTER, XLOOKUP.
Kyle Stott

Author

Kyle Stott

Certified Microsoft Excel Expert

Kyle has worked professionally with Microsoft Excel for over a decade and has consulted on and taught Excel best practices to over 400 companies across 30+ countries.