REDUCE Function
The REDUCE
function in Google Sheets applies a specified LAMBDA
function to reduce an array or range to a single value.
Syntax
REDUCE(initial_value, array_or_range, LAMBDA)
initial_value
: The starting value for the reduction.array_or_range
: The range or array to reduce.LAMBDA
: A custom function to apply to each element.
Examples
- Basic Example
Calculate the sum of all values in range A1:A5
starting from an initial value of 0:
=REDUCE(0, A1:A5, LAMBDA(acc, x, acc + x))
Notes
- Useful for aggregating data based on custom logic.
Related Functions
SCAN
: Apply a function to accumulate values in an array.