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.
- IFSEvaluates multiple conditions and returns a value that corresponds to the first true condition.LogicalExcel
- LAMBDACreates and returns a custom function with a set of names and a formula_expression that uses them. To calculate the formula_expression, you can call the returned function with as many values as the name declares.LogicalExcel
- AVERAGEIFReturns the average of a range depending on criteria.StatisticalExcel
- CELLReturns the requested information about the specified cell.InfoExcel
- CSCReturns the cosecant of an angle provided in radians. .MathExcel
- FILTERReturns a filtered version of the source range, returning only rows or columns which meet the specified conditions.FilterExcel