Skip to main content
SheetCraft
🧮 LAMBDA Helpers Function · advanced

REDUCE Function in Google Sheets

Folds an array into a single value by applying a LAMBDA cumulatively. The functional-programming pattern for running totals, custom aggregates, and any "summarize this list" calculation.

Syntax

REDUCE(initial_value, array, lambda)

Returns: The final accumulator value after applying the lambda to every element.

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

Introduced: 2022

Parameters

NameRequiredDescription
initial_valueRequiredStarting accumulator value.
arrayRequiredThe array to fold over.
lambdaRequiredA LAMBDA taking (accumulator, current_value) and returning the next accumulator.

Examples

Sum via REDUCE (illustrative)

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

Equivalent to SUM(A2:A100). Use SUM in practice — this shows the pattern.

Custom product

=REDUCE(1, A2:A100, LAMBDA(acc, x, acc * x))

Multiplies all values. Equivalent to PRODUCT but illustrates how to write your own.

Concatenate with separator

=REDUCE("", A2:A100, LAMBDA(acc, x, IF(acc="", x, acc & ", " & x)))

Builds a comma-separated string. TEXTJOIN is cleaner for this; REDUCE shines for cases without a built-in.

When to use an alternative

  • SUM / PRODUCT / COUNT / etc.Your aggregate is already a built-in function.
  • SCANYou want to keep all intermediate values, not just the final result.
  • MAP + sumYou'd transform first, then aggregate.

Common errors and how to fix them

  • Wrong initial value

    Cause: Passed 0 for a product or 1 for a sum.

    Fix: 0 for additive operations, 1 for multiplicative, empty string for concatenation.

  • Lambda arity

    Cause: REDUCE lambdas always take exactly (acc, x). Three params won't work.

    Fix: Combine with LET inside the lambda if you need intermediate names.

Related functions

Frequently Asked Questions

When is REDUCE worth it over SUM/PRODUCT?

When the aggregate isn't built-in. Examples: weighted running max, custom rolling formulas, building a structured output from a list. For plain sum/product/count, use the built-ins — they're optimized.

What's the difference between REDUCE and SCAN?

REDUCE returns only the final accumulator. SCAN returns the accumulator at every step — useful for running totals you want to display per row. Same lambda shape, different output.

Source: Google Sheets official function reference.