Applying a LAMBDA to each item in the array and returning the total value in the accumulator reduces the array to an accumulated value.
Syntax :
=REDUCE([initial_value], array, lambda(accumulator, value))
Parameters :
[initial value] – Defines the accumulator’s starting value.
array – A to-be-reduced array.
lambda – A LAMBDA function that is used to decrease the array. The LAMBDA considers two variables:
accumulator – A value that is totalled and returned as the final result.
value – The computation performed on each array element.
Example :
=REDUCE(, A1:C2, LAMBDA(a,b,a+b^2))
To set the initial value for the accumulator parameter, use the initial value argument. Set the value of the accumulator to 1 in Example 2 to prevent multiplying by 0.
If you supply an improper LAMBDA function or a wrong amount of arguments, you will receive a #VALUE! error named “Incorrect Parameters.”
Ask Your Query