[]
        
(Showing Draft Content)

REDUCE

This function reduces an array to an accumulated value by applying a LAMBDA to each value and returning the total value in the accumulator.

Syntax

REDUCE([initial_value], array, lambda(accumulator, value, body))

Arguments

Argument

Description

[initial_value]

[Optional] Sets the starting value for the accumulator

array

[Required] An array to be reduced

lambda

[Required] A LAMBDA that is called to reduce the array. The LAMBDA takes three parameters:

  • accumulator - The value totaled up and returned as the final result

  • value - The current value from the array

  • body - The calculation applied to each element in the array

Remarks

Use the initial_value argument to set the starting value for the accumulator parameter.

Examples

REDUCE(, A1:C2, LAMBDA(a,b,a+b^2))