# How to Sum the Smallest N Values in Excel

Sometimes we may want to sum the first smallest N numbers in a range in Excel. In this article, we will show you the method of “SUM the Smallest N Numbers” by a simple formula which consist of SUMPRODUCT and SMALL functions. SMALL can return smallest values based on criteria, SUMPRODUCT can sum up these smallest values.

Through a simple instance, we will introduce you the syntax, argument and the usage of SUMPRODUCT and SMALL functions. We will let you know how the formula works step by step clearly. After reading the article, you may know that in which situations we can choose SUMPRODUCT function to sum data.

## 1. Sum the Smallest N Values Using SUM Formula

In the ‘Value’ column, there are 10 values from ‘1’ to ‘10’ in improper order. Now we want to sum the smallest 4 values from this list, how can we get the correct result?

Actually, we can sort these numbers from smallest to largest firstly by ‘Sort A-Z’ in excel.

Step1: Click ‘Data’ tab, under ‘Sort & Filter’ section click ‘Sort Smallest to Largest’ icon.

Step2: Then you can find numbers are ordered properly.

Step3: Then you can enter SUM function in B2 and select the first four numbers ->cell reference A2:A5 in the list.

Step4: Then you can get the sum of the smallest four values.

## 2. Sum the Smallest N Values Using SUMPRODUCT Formula

We can also get sum conveniently and correctly by just enter a formula. As we want to sum the smallest four numbers from range A2:A11, we can find the smallest N number or numbers by SMALL function actually, and then use SUMPRODUCT function to sum array directly.

Step1: In B2, enter the formula

``=SUMPRODUCT(SMALL(A2:A11,{1,2,3,4}))``

Step2: Press Enter after typing the formula.

We can see that this time we also get correct result 10. The formula works correctly.

HOW THIS FORMULA WORKS

The formula is converted as:

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

Now we will show you how the formula works with the two functions.

For SMALL({1;3;5;6;9;10;7;8;4;2},{1,2,3,4}), refer to k value {1,2,3,4}, we find out the smallest 4 values in the array {1;3;5;6;9;10;7;8;4;2}.

Select SMALL({1;3;5;6;9;10;7;8;4;2},{1,2,3,4}) in the formula bar, press F9. We can get the result {1,2,3,4}.

Obviously, the final result is 1+2+3+4=10. Select SUMPRODUCT({1,2,3,4}) in the formula bar, press F9, 10 is displayed in formula bar.

## 3. Sum the Smallest N Values in Excel with User Defined Function with VBA Code

You can create a user-defined function in Excel to sum the smallest N values in a range of cells. Here are the steps:

Step1: Press Alt + F11 to open the Visual Basic Editor.

Step2: Click Insert > Module to insert a new module.

Step3: Copy and paste the following code into the module. Save the module and close the Visual Basic Editor.

``````Function SumSmallestN_Excelhow(rng As Range, n As Integer) As Double
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim temp As Double
Dim sum As Double

For i = 1 To n
For j = i To rng.Cells.count - 1
If rng.Cells(j).Value < rng.Cells(i).Value Then
temp = rng.Cells(i).Value
rng.Cells(i).Value = rng.Cells(j).Value
rng.Cells(j).Value = temp
End If
Next j
sum = sum + rng.Cells(i).Value
Next i

SumSmallestN_Excelhow = sum
End Function``````

Step4: enter the formula into a blank cell:

``=SumSmallestN_Excelhow(A2:A11,4)``

Where A2:A11 is the range of cells you want to sum and 4 is the number of smallest values you want to sum.

Step5: Press Enter to calculate the sum of the smallest 4 values in the range.

## 4. Video: Sum the Smallest N Values in Excel

This video will demonstrate how to sum the smallest N values in Excel using a formula or  a User Defined Function with VBA code as the formula.

## 5. Related Functions

• Excel SUMPRODUCT function
The Excel SUMPRODUCT function multiplies corresponding components in the given one or more arrays or ranges, and returns the sum of those products.The syntax of the SUMPRODUCT function is as below:= SUMPRODUCT (array1,[array2],…)…
• Excel INDIRECT function
The Excel INDIRECT function returns the cell reference based on a text string, such as: type the text string “A2” in B1 cell, it just a text string, so you can use INDIRECT function to convert text string as cell reference….
• Excel ROW function
The Excel ROW function returns the row number of a cell reference.The ROW function is a build-in function in Microsoft Excel and it is categorized as a Lookup and Reference Function.The syntax of the ROW function is as below:= ROW ([reference])….
• Excel SMALL function
The Excel SMALL function returns the smallest numeric value from the numbers that you provided. Or returns the smallest value in the array.The syntax of the SMALL function is as below:=SMALL(array,nth) …
• Excel SUM function
The Excel SUM function will adds all numbers in a range of cells and returns the sum of these values. You can add individual values, cell references or ranges in excel.The syntax of the SUM function is as below:= SUM(number1,[number2],…)
{"ft_lang_label":"__label__en","ft_lang_prob":0.7100636,"math_prob":0.9708127,"size":4938,"snap":"2023-40-2023-50","text_gpt3_token_len":1277,"char_repetition_ratio":0.16882853,"word_repetition_ratio":0.041062802,"special_character_ratio":0.25799918,"punctuation_ratio":0.16064982,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99946636,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2023-09-23T03:49:47Z\",\"WARC-Record-ID\":\"<urn:uuid:9c706290-e376-41eb-bcf2-a014b150ff06>\",\"Content-Length\":\"96829\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:df6b6424-76b6-4a41-ab21-a14b23f2709b>\",\"WARC-Concurrent-To\":\"<urn:uuid:75bc9c16-1459-4d95-80fc-0617e1603e55>\",\"WARC-IP-Address\":\"18.213.98.197\",\"WARC-Target-URI\":\"https://www.excelhow.net/how-to-sum-the-smallest-n-values-in-excel.html\",\"WARC-Payload-Digest\":\"sha1:HXRUARGLIYYTRNBOSDL7AV6H5BCKHOFT\",\"WARC-Block-Digest\":\"sha1:V5PT45N2AC3OFWEMOFJKPDTYNFCHWQ3S\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2023/CC-MAIN-2023-40/CC-MAIN-2023-40_segments_1695233506479.32_warc_CC-MAIN-20230923030601-20230923060601-00069.warc.gz\"}"}