Reduce an array.

`=REDUCE([initial_value], array, lambda)`

- initial_value - [OPTIONAL] the initial value for the accumulator
- array - REQUIRED the array to be reduced
- lambda - REQUIRED the custom LAMBDA function

`=REDUCE(0,{1,2,3,4,5},LAMBDA(a,b,a+b))`

This example demonstrates the simplest use of the REDUCE function. It adds all values in a list of numbers using the formula. In this example, the REDUCE function returns 15.

`=REDUCE(1,{1,2,3,4,5},LAMBDA(a,b,a*b))`

The REDUCE function can also be used for multiplication. This formula multiplies all values in a list of numbers and returns 120.

The REDUCE function is used to reduce an array by applying a LAMBDA function to each value. The LAMBDA takes three arguments and the result is returned as the accumulated value with an initial_value set as the starting value.

- The REDUCE function applies a custom LAMBDA function to each element in a given array and returns the sum of results to a single value, making it a useful tool for processing and returning a single value.

The REDUCE function is a powerful JavaScript array method that applies a custom LAMBDA function to each element in an array, optionally reducing its size. It can be used to process each element in an array row by row, and returns a single value if the input values are equal.

The REDUCE function can be used for a variety of tasks, including:

- Calculating conditional sums and counts, such as SUMIFS and COUNTIFS.
- Processing each element in an array and returning a new array of results.
- Calculating a final accumulated result.
- Using a named LAMBDA to manage the logic in one location.

Using the REDUCE function is relatively straightforward. First, you'll need to create a custom LAMBDA function that you want to apply to each element in the array. Then, you can use the REDUCE method to apply the LAMBDA to each element in the array, optionally reducing the size of the array.

Drop CSV