Array

REDUCE Formula

Accumulates a single result by applying a LAMBDA function sequentially to each element of an array, carrying forward an accumulator. REDUCE is the spreadsheet version of fold/reduce from programming — it processes a list from top to bottom, building up a final answer like a running total, product, or concatenation.

Syntax

REDUCE(initial_value, array, lambda)
ParameterDescription
initial_value Parameter of the REDUCE function.
array Parameter of the REDUCE function.
lambda Parameter of the REDUCE function.
Try REDUCE in Viztab — free, no signup

Examples

Running product (multiply all values)

Formula
=REDUCE(1, A1:A5, LAMBDA(acc, val, acc*val))
Returns the product of all values in A1:A5. Starts with 1, multiplies by each value in sequence. If values are 2,3,4,5,6 the result is 720.

Concatenate with delimiter

Formula
=REDUCE("", A1:A5, LAMBDA(acc, val, IF(acc="", val, acc&", "&val)))
'Apple, Banana, Cherry, Date, Fig'. Builds a comma-separated string from the list without a leading comma.

Count values meeting a condition

Formula
=REDUCE(0, B1:B100, LAMBDA(count, x, count + IF(x>50, 1, 0)))
Counts how many values in B1:B100 exceed 50. Equivalent to COUNTIF but demonstrates REDUCE's flexibility.

Common Errors

#VALUE!

The LAMBDA doesn't accept exactly 2 parameters (accumulator and current value).

#CALC!

The LAMBDA body produces an error during iteration, halting the reduction.

Tips

Initial value matters

Use 0 for sums/counts, 1 for products, "" for string concatenation. The initial value is what the accumulator starts at before the first element.

LAMBDA receives (accumulator, current_value)

The first parameter is the running result from all previous iterations. The second is the current array element being processed.

Use when SUM/PRODUCT aren't enough

REDUCE shines for custom aggregations that built-in functions can't handle, like conditional string building, running max/min with logic, or multi-step accumulations.

Try REDUCE in Viztab

Import your data and use REDUCE with 370+ other formulas. No signup required.

Open Viztab

Related Formulas