LET function in Google Sheets
Assigns name with the value_expression results and returns the result of the formula_expression. The formula_expression can use the names defined in the scope of the LET function. The value_expressions are evaluated only once in the LET function even if the following value_expressions or the formula_expression use them multiple times.
=LET(name1, value_expression1, [name2, …], [value_expression2, …], formula_expression )LET syntax and parameters
Five arguments, three required.
- name1stringRequired
A name used inside the next value_expressions and the formula_expression. This must be an identifier (details below), and usage is case-insensitive.
- value_expression1anyRequired
Formula whose result can be referred to later with the name that was declared before. It can use names declared in the previous parameters. For example, AVERAGE(B2:D2).
- name2stringRepeating
[ OPTIONAL ] Repeatable, additional names to be assigned.
- value_expression2anyRepeating
[ OPTIONAL ] Repeatable, additional value_expressions to be evaluated.
- formula_expressionanyRequired
Formula to be calculated. It uses names declared in the LET function.
LET examples
Formulas you'll actually reuse.
Name the tax rate once instead of repeating it four times:
=LET(tax, 0.19, net, B2, gross, net * (1 + tax), TEXT(gross, "$#,##0.00") & " incl. VAT" )Result
"$118.99 incl. VAT"Reuse an expensive calculation — outliers above 2σ, computed once:
=LET(range, B2:B13, avg, AVERAGE(range), sd, STDEV(range), COUNTIF(range, ">" & (avg + 2 * sd)) )Result
2
LET in Excel
Same name — your formula ports as-is.
Try LET in the playground
Edit the example — nothing to install.
Preloaded with the LET formula from Example 1 — change anything and watch it respond.
LET errors
What they mean — and the fixes.
#NAME?A value expression references a name defined after it — LET only sees names declared earlier in the argument list.
Related functions
More ways Google Sheets gets this done.
- ANDReturns true if all of the provided arguments are logically true, and false if any of the provided arguments are logically false.LogicalExcel
- FALSEReturns the logical value `FALSE`.LogicalExcel
- IFReturns one value if a logical expression is `TRUE` and another if it is `FALSE`.LogicalExcel
- IFERRORReturns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.LogicalExcel
- IFNAEvaluates a value. If the value is an #N/A error, returns the specified value. .LogicalExcel
- IFSEvaluates multiple conditions and returns a value that corresponds to the first true condition.LogicalExcel