REDUCE function
Summary
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))
The REDUCE function syntax has the following arguments and parameters:
• [initial_value] Sets the starting value for the accumulator.
• array An array to be reduced.
• lambda 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.
• 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.
• [initial_value] Sets the starting value for the accumulator.
• array An array to be reduced.
• lambda 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.
• 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.
Example
=REDUCE(, A1:C2, LAMBDA(a,b,a+b^2))
=REDUCE(1,Table3[nums],LAMBDA(a,b,IF(b>50,a*b,a)))
=REDUCE(0,Table4[Nums],LAMBDA(a,n,IF(ISEVEN(n),1+a, a)))
=REDUCE(1,Table3[nums],LAMBDA(a,b,IF(b>50,a*b,a)))
=REDUCE(0,Table4[Nums],LAMBDA(a,n,IF(ISEVEN(n),1+a, a)))