Array

LET Formula

Assigns names to intermediate calculation results and then uses them in a final formula, improving readability and performance. LET is essential for complex formulas where the same sub-expression appears multiple times — instead of recalculating it, compute it once, name it, and reuse it.

Syntax

LET(name1, value1, [...], calculation)
ParameterDescription
name1 Parameter of the LET function.
value1 Parameter of the LET function.
[...] (Optional.) Parameter of the LET function.
calculation Parameter of the LET function.
Try LET in Viztab — free, no signup

Examples

Avoid repeated calculations

Formula
=LET(total, SUM(A1:A100), avg, total/COUNTA(A1:A100), IF(avg>50, "Above", "Below"))
'Above' or 'Below'. Calculates total once, uses it to compute average, then evaluates the condition — more efficient than nesting SUM twice.

Named intermediate range

Formula
=LET(data, FILTER(A1:C100, B1:B100>1000), SORT(data, 3, -1))
Filters the data once into a named variable, then sorts it. Without LET, you'd nest SORT(FILTER(...)) which is harder to read and debug.

Tax calculation with named rates

Formula
=LET(price, B2, taxRate, 0.0875, shipping, 5.99, price*(1+taxRate)+shipping)
Calculates total cost using named values for clarity. Each variable name documents what the number represents.

Common Errors

#VALUE!

Odd number of arguments (each name needs a value), or a name is not a valid identifier.

#CALC!

One of the named calculations produces an error that propagates to the final result.

Tips

Performance benefit

If you use SUM(A:A) three times in a formula, it's calculated three times. With LET(s, SUM(A:A), ...), it's calculated once. This matters with large datasets.

Names must be valid identifiers

Variable names can't contain spaces or start with numbers. Use camelCase like 'totalSales' or underscores like 'total_sales'.

Stack multiple variables

LET(a, 1, b, 2, c, a+b, c*10) — you can define many variables, and later variables can reference earlier ones. The last argument is always the return value.

Try LET in Viztab

Import your data and use LET with 370+ other formulas. No signup required.

Open Viztab

Related Formulas