Syntax
| Parameter | Description |
|---|---|
| name1 | Parameter of the LET function. |
| value1 | Parameter of the LET function. |
| [...] | (Optional.) Parameter of the LET function. |
| calculation | Parameter of the LET function. |
Examples
Avoid repeated calculations
=LET(total, SUM(A1:A100), avg, total/COUNTA(A1:A100), IF(avg>50, "Above", "Below"))
Named intermediate range
=LET(data, FILTER(A1:C100, B1:B100>1000), SORT(data, 3, -1))
Tax calculation with named rates
=LET(price, B2, taxRate, 0.0875, shipping, 5.99, price*(1+taxRate)+shipping)
Common Errors
Odd number of arguments (each name needs a value), or a name is not a valid identifier.
One of the named calculations produces an error that propagates to the final result.
Tips
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.
Variable names can't contain spaces or start with numbers. Use camelCase like 'totalSales' or underscores like 'total_sales'.
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