REDUCE
TheREDUCE
formula is used to apply a function to each element of an array, resulting in a single output value. The function specified in LAMBDA
is applied to the elements of the array in turn, and the final result is obtained by accumulating these element-wise results. This formula is often used to sum or multiply the elements of an array.
- How to use
REDUCE
formula? - Examples of using
REDUCE
formula REDUCE
formula not working?- Similar formulas to
REDUCE
Usage
Use the REDUCE
formula with the syntax shown below, it has 3 required parameters:
- initial_value (required):
The initial value for the reduction operation. This value is used as the accumulator for the first element in the array. - array_or_range (required):
The array or range of cells to be reduced. If a range is provided, the cells are read from left to right and top to bottom. - LAMBDA (required):
A function that takes two arguments: the current accumulator value and the current element of the array. The function should return the new accumulator value.
Examples
Here are a few example use cases that explain how to use theREDUCE
formula in Google Sheets.
Sum a range of cells
To sum a range of cells, use the REDUCE
formula with an initial value of zero and a LAMBDA
function that adds the current element to the accumulator.
Multiply a range of cells
To multiply a range of cells, use the REDUCE
formula with an initial value of one and a LAMBDA
function that multiplies the current element by the accumulator.
Find the maximum value in a range
To find the maximum value in a range, use the REDUCE
formula with an initial value of MIN_VALUE
and a LAMBDA
function that returns the greater of the current element and the accumulator.
Common Mistakes
REDUCE
not working? Here are some common mistakes people make when using the REDUCE
Google Sheets Formula:
Providing a non-array or non-range input
REDUCE requires an array or range as its second argument. Providing a non-array or non-range input will result in an error.
Not providing a lambda function
REDUCE requires a lambda function as its third argument. Not providing a lambda function will result in an error.
Providing a lambda function with the wrong number of arguments
The lambda function provided to REDUCE must take two arguments. Providing a lambda function with the wrong number of arguments will result in an error.
Related Formulas
The following functions are similar to REDUCE
or are often used with it in a formula:
-
SUM
The
SUM
function in Google Sheets adds up a range of numbers. This function is most commonly used to sum the values in a range of cells. -
PRODUCT
The
PRODUCT
formula in Google Sheets multiplies all the numbers given in the arguments and returns the product. It is commonly used to calculate the total product of a range of cells. -
MAX
The
MAX
function returns the maximum value from a range of cells or a set of supplied values. It is commonly used to find the largest value in a dataset. -
MIN
The
MIN
formula is a statistical function that returns the smallest value in a set of numbers. It is commonly used to find the minimum value from a range of cells or a list of values. -
FILTER
The FILTER formula in Google Sheets is used to filter a range of data based on specified conditions. It returns a new range that only includes the rows that meet the specified conditions. This formula is commonly used to extract specific data from a larger dataset.
Learn More
You can learn more about the REDUCE
Google Sheets function on Google Support.