# Sum bottom n values

=SUMPRODUCT(SMALL(range,{1,2,n}))

To sum the lowest **n** values in a range, you can use a formula based on the SMALL function and the SUMPRODUCT function. In the generic form of the formula above, **range** contains numeric values and **n** is the number of values to sum. In the example shown, the formula in cell E5 is:

=SUMPRODUCT(SMALL(data,{1,2,3}))

where **data** is the named range B5:B16. The result is the sum of the smallest 3 values (10, 15, 20) which is 45.

In this example, the goal is to sum the smallest **n** values in a set of data, where **n** is a variable that can be easily changed. At a high level, the solution breaks down into two steps (1) extract the **n** smallest values from the data set and (2) sum the extracted values. This problem can be solved with the SMALL function together with the SUMPRODUCT function, as explained below. For convenience only, the range B5:B16 is named "data".

### SMALL function

The SMALL function is designed to return the *nth* smallest value in a range. For example:

Normally, SMALL returns just one value. However, if you supply an array constant (e.g. a constant in the form {1,2,3}) to SMALL as the second argument, *k* , SMALL will return an array of results instead of a single result. For example:

=SMALL(A1:A10,{1,2,3})

will return the 1st, 2nd, and 3rd smallest values in the range A1:A10.

### Example

In the example shown, the formula in E5 is:

=SUMPRODUCT(SMALL(data,{1,2,3}))

Working from the inside out, the SMALL function is configured to return the 3 smallest values in the range B5:B16:

=SMALL(data,{1,2,3}) // returns {10,15,20}

Because we provide three separate values for *k*, the result is an array that contains three results:

{10,15,20}

This array is returned directly to the SUMPRODUCT function:

SUMPRODUCT({10,20,30}) // returns 45

With just a single array to process, SUMPRODUCT sums the values in the array and returns 45 as a final result.

### SUM alternative

It is common to use SUMPRODUCT in problems like this because SUMPRODUCT can handle arrays natively without any special handling in Legacy Excel. However, in a modern version of Excel, you can use the SUM function instead:

*Note: this is an array formula and must be entered with Control + Shift + Enter in Legacy Excel.*

### When n becomes large

As **n** becomes a larger number, it becomes tedious to enter longer array constants like {1,2,3,4,5,6,7,8,9,10}, etc. In this situation, you can use a shortcut to create an array that contains sequential numbers automatically based on the ROW and INDIRECT functions. For example, to sum the lowest 10 values in a range, you can use a formula like this:

=SUMPRODUCT(SMALL(range,ROW(INDIRECT("1:10"))))

Here, the INDIRECT function converts the text string "1:10" to the *range* 1:10, which is returned to the ROW function. The ROW function then returns the 10 row numbers that correspond to the range 1:10 in an array like this:

{1;2;3;4;5;6;7;8;9;10}

Note this is actually a vertical array, as indicated by the semicolons (;) but the SMALL function will happily accept a vertical or horizontal array as the *k* argument. Once INDIRECT and ROW have been evaluated, the formula is in the same form as before:

=SUMPRODUCT(SMALL(range,{1;2;3;4;5;6;7;8;9;10}) // sum 10 smallest

SMALL will return the 10 lowest values, and SUMPRODUCT will return the sum of these values as a final result.

### Variable n

To set up a formula where **n** is a variable in another cell, you can concatenate inside INDIRECT. For example, if A1 contains **n**, you can use:

=SUMPRODUCT(SMALL(range,ROW(INDIRECT("1:"&A1))))

This allows a user to change the value of **n** directly on the worksheet and the formula will respond instantly.

### With the SEQUENCE function

New in Excel 365, the SEQUENCE function can generate numeric arrays directly in one step, which eliminates the need for the ROW + INDIRECT combination explained above. In fact, with SEQUENCE there is really no need to use array constant either. We can simplify the formula as follows:

*Note: Because SEQUENCE requires the new dynamic array engine in Excel (where array behavior is native), we have also replaced SUMPRODUCT with the SUM function. Read more about SUMPRODUCT and arrays here.*

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

## Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.