Syntax
| Parameter | Description |
|---|---|
| initial_value | Parameter of the REDUCE function. |
| array | Parameter of the REDUCE function. |
| lambda | Parameter of the REDUCE function. |
Examples
Running product (multiply all values)
=REDUCE(1, A1:A5, LAMBDA(acc, val, acc*val))
Concatenate with delimiter
=REDUCE("", A1:A5, LAMBDA(acc, val, IF(acc="", val, acc&", "&val)))
Count values meeting a condition
=REDUCE(0, B1:B100, LAMBDA(count, x, count + IF(x>50, 1, 0)))
Common Errors
The LAMBDA doesn't accept exactly 2 parameters (accumulator and current value).
The LAMBDA body produces an error during iteration, halting the reduction.
Tips
Use 0 for sums/counts, 1 for products, "" for string concatenation. The initial value is what the accumulator starts at before the first element.
The first parameter is the running result from all previous iterations. The second is the current array element being processed.
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