REDUCE

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

Returns the total value after reducing an array by applying a LAMBDA function.

[initial_value]Sets the starting value for the accumulator.
arrayAn array to be reduced.
lambdaA nested LAMBDA function that takes two parameters.
accumulatorThe value totalled up and returned as the final result.
valueThe calculation applied to each element in the array

REMARKS
* This function was added in Microsoft 365.
* This function uses the LAMBDA function.
* This LAMBDA function must take two parameters.
* This LAMBDA function must have parameter names that do not include numbers.
* You can use the MAP function to return an identical array by applying a LAMBDA function to do some processing.
* You can use the SCAN function to return an identical array by applying a LAMBDA function to return some intermediate calculation values.
* This function was first released in July 2021.
* For the Microsoft documentation refer to support.microsoft.com
* For the Google documentation refer to support.google.com

 ABCDE
1=REDUCE(1, C1:E2, LAMBDA(p_one, p_two, p_one+p_two)) = 22 123
2=REDUCE(10, C1:E2, LAMBDA(p_one, p_two, p_one+p_two)) = 31 456
3=REDUCE(1, C1:E2, LAMBDA(p_one, p_two, p_one*p_two)) = 720    

1 - We would like to display the total of all the numbers, with an initial value of 1.
2 - We would like to display the total of all the numbers, with an initial value of 10.
3 - We would like to display the total value after multiplying all the numbers together.

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top