Reduces an array to an accumulated result by application of a LAMBDA function to each value. Learn more
The REDUCE function in Google Sheets is a powerful tool for performing iterative calculations on arrays or ranges of values. It takes three arguments:
The initial value: This is the starting value for the iteration. It can be any valid value or reference.
The array or range: This is the set of values to be iterated over. It can be a range of cells, an array of values, or any other valid reference to a set of values.
The lambda function: This is a function that defines the operation to be performed on each element of the array or range. It takes two arguments: the accumulated value from the previous iteration and the current element of the array or range.
The REDUCE function applies the lambda function to each element of the array or range, with the initial value passed as the first argument. The results of each iteration are accumulated and passed as the first argument to the next iteration, until all elements of the array or range have been processed. The final result is the accumulation of all the intermediate results.
The lambda function can be any valid function that takes two arguments, such as SUM, PRODUCT, AVERAGE, MAX, MIN, or any custom function that you define.