Skip to main content
SheetCraft
🧮 LAMBDA Helpers Function · advanced

LAMBDA Function in Google Sheets

Defines a reusable function inline. Combined with MAP, REDUCE, BYROW, and BYCOL, this brings functional programming to Sheets. The most powerful modern addition to the formula language.

Syntax

LAMBDA(name1, [name2, ...], formula_expression)

Returns: A function value. Usually passed to MAP, REDUCE, BYROW, BYCOL, or used in named functions.

Excel equivalent: LAMBDA (identical, requires Excel 2021+ or Microsoft 365)

Introduced: 2022

Parameters

NameRequiredDescription
name1, name2, ...RequiredParameter names for the lambda.
formula_expressionRequiredThe body of the function using the named parameters.

Examples

Apply a calculation to each row with MAP

=MAP(A2:A100, LAMBDA(x, x * 1.1))

Multiplies every value in A2:A100 by 1.1. The lambda is the per-row function MAP calls.

Two-argument lambda for ranking

=BYROW(A2:B100, LAMBDA(row, INDEX(row, 1) + INDEX(row, 2)))

Sums the two columns in each row. The lambda receives the entire row as a horizontal array.

REDUCE to find a running total

=REDUCE(0, A2:A100, LAMBDA(acc, x, acc + x))

Equivalent to SUM but illustrates the pattern: start with 0, apply the lambda to (accumulator, next value) for each item.

When to use an alternative

  • ARRAYFORMULAYour operation is a straightforward column transform.
  • Named Function (Data → Named Functions)You want to reuse a LAMBDA across many cells with a clean name.
  • Apps Script custom functionYour logic is too complex for a single expression.

Common errors and how to fix them

  • #NUM! "Did not find value"

    Cause: LAMBDA used standalone (not inside MAP/REDUCE/etc.).

    Fix: LAMBDA must be applied — pass it to MAP, BYROW, BYCOL, REDUCE, or assign it as a Named Function.

  • Wrong arity

    Cause: MAP receives a 2-column range but LAMBDA only declares one parameter.

    Fix: Match parameter count to what the iterator passes. MAP over A2:A100 needs LAMBDA(x, ...); MAP over A2:B100 needs LAMBDA(a, b, ...).

Related functions

Frequently Asked Questions

What's the difference between LAMBDA and a Named Function?

LAMBDA defines a function inline. A Named Function (Data → Named Functions) stores a LAMBDA with a name you can call anywhere in the sheet like a built-in. For one-shot use, inline LAMBDA. For reuse across many cells, define a Named Function backed by the same LAMBDA.

Can a LAMBDA call another LAMBDA?

Yes — lambdas can take other lambdas as arguments and pass them along. This enables higher-order patterns like SCAN or PARTIAL APPLICATION. Combined with LET, you can build surprisingly sophisticated logic.

Source: Google Sheets official function reference.