Method 3: Rowing forward with Old friends to make new Indirectly - Using SUM to sum top n values
After grabbing the basics of LARGE function in no time. Let’s start making our lives a little easier.
Requirements of real world can go in any direction and to any extent. So far we have learnt how to SUM the top three values in a range. But what if we want to sum the top 10 or top 30 values? Well in that case we will have to type all the numbers from 1 to 10 or 30 inside curly brackets and may be by the time you punch in the whole series your fingers are also curled…
So save yourself and let’s make another move. But first let’s understand what we need. We need a simple solution that can give us required series of numbers in an array. There are number of ways to do it but the easiest of all is use to ROW function to generate an array of required N numbers to sum.
Until now we knew ROW function gives us the row number of the cell in which ROW function is applied. For example if we put this formula in cell A11 the result is 11 on pressing Enter.
However, if we put a range to it it transforms into an array. To confirm put following formula in any cell and DO NOT press Enter:
=ROW(a1:a10)
Now select the formula and press F9 key and you will see the following result:
{1;2;3;4;5;6;7;8;9;10}
This is exactly what we are after. So using the last formula we learnt to SUM top three values, in place of curly brackets and its content add in ROW(A1:A3), your formula will look like this:
=SUM(LARGE(numbers,ROW(A1:A3)))
Here is a tricky part, instead of pressing Enter key you have to press Ctrl+Shift+Enter. The reason is that in order to make ROW function to form an array of {1;2;3} you have to command excel to solve it as an array formula. Otherwise formula won’t work. So press the combo and get the result. If you look in the formula bar after hitting the combo of three keys you will find formula to be like this:
{=SUM(LARGE(numbers,ROW(A1:A3)))}
The curly brackets enclosing the whole formula is representing only that this is executed as an array formula and not as a simple formula.
Now if you want to sum the top 10 values simple replace A3 with A10 and you will get it done in which case formula will become:
=SUM(LARGE(numbers,ROW(A1:A10)))
Don’t forget about Ctrl+Shift+Enter!
Another alternative formula to achieve the same using ROW function is:
=SUM(large(numbers,ROW(Indirect(“1:10”))))
The above formula provides you with numbers without making a selection of rows as it was the case in above formula. It is a safer bet.
Method 4(A): Total legacy of SUM extended - SUMIF and SUMPRODUCT
Few days back we learn about advanced and new formula in Excel that provide you ready solution to add up values in data based particular criteria. That way you don’t have to mingle in SUM and IF function together. As we want to sum the top n values, this is basically a condition and we can use SUMIF and SUMPRODUCT to get the job done for us.
Using SUMIF to get the sum of top 10 or any nth number of values the formula can be:
=SUMIF(numbers,”>=”&LARGE(numbers,10))
Remember, “numbers” is the name of range we defined earlier in the discussion. This formula is simply adding up all those numbers that are greater than or equal to the 10th largest number in the range. Simple :). If you want top 3 or 4 or 30 values to be summed then simply replace the figure of 10 in the formula above with your desired amount.
Notice that logical operators are in inverted commas and LARGE function is joined using &. For some reason SUMIF don’t work if we don’t put criteria in inverted commas. If I find the reason I will let you know. And someone out there know the reason please share in the comment section 🙂
To learn how to use SUMIF with dates read: Using SUMIF with Dates in Excel
Bonus Tip - sum top n positive or negative values values
Bonus Tip - SUM the TOP n negative numbers
You might have a data that consists of both positive and negative numbers. If we talk about lowest or largest numbers then positive and negative numbers get counted. However, if you like to sum just top or least n values of positive or negative figures then you can use SUMIF formula very easily:
To sum top 3 positive values in the data range
=SUM(LARGE(IF(E285:E295>0,E285:E295),{1,2,3}))
To sum top 3 negative values in the date you simply have to change > to <
=SUM(LARGE(IF(E285:E295<0,E285:E295),{1,2,3}))
Remember these are array formulas and have to executed by pressing Ctrl+Shift+Enter
A little bloated version of SUMIF to add up top 10 values of positive figures is as follows:
=SUMIF(numbers,”>=”&LARGE((numbers)*-((numbers)>0),10))
Method 4(B) Using SUMPRODUCT to sum top n values
SUMPRODUCT is one fantastic formula that let you do many things so easily and most of the time without even thinking much of structuring the formula correctly. The way it handles the conditions even the multiples of conditions is superb. However, it does have a downside and its use is decreasing since the introduction of SUMIF. The reason is it slows down the workbook because of the way it works. But cutting the details at least for our data and with few hundreds we can use this formula.
=SUMPRODUCT(LARGE(numbers,ROW(A1:A10)))
Now this formula looks surprisingly similar to the SUM formula we applied in method above. Wait for sum with multiple conditions later in this article to see SUMPRODUCT in real action :). So far it is working exactly the same way as simple SUM function was working. I will explain its working in multiple conditions.
To learn how SUMPRODUCT function works and other articles visit this page
Method 5: Another in the rank - Using SUMPRODUCT and RANK to sum top n values
Another variation of of the use of SUMPRODUCT. Here we are using RANK functions. RANK function tells you, well the name is telling the whole story, rank of a number inside a data range. But we made a cheeky use of it. Instead of giving a single number we provided a whole range and put it against a logical test “<11”. As a result this part of the formula churns out TRUEs and FALSEs by checking each number in the range if it is greated than the 11th largest number. By adding two dashes before it we converted a logical array to Boolean array of 1s and 0s as SUMPRODUCT can use 1s and 0s to get the product of numbers or arguments or conditions whatever you call it. So here is the formula you can use:
=SUMPRODUCT(numbers*-(RANK(numbers,numbers)<11))

Good day
i have a challenge . been working on a report card, but i can’t go through 🙁
NAME ENG MATHS ADMA BIO GEO CIV PHY CHE AVG PSN
BRIAN 55 3 66 2 63 2 72 2 55 3 71 2 83 1 80 1 427 68 8
BKALUMO 65 2 52 3 0 FAIL 65 2 70 2 60 2 88 1 50 3 400 56 16
IAN 70 2 24 FAIL 36 FAIL 50 3 58 3 71 2 75 1 18 FAIL 360 50 22
TREVIS 88 1 54 3 51 3 80 1 70 2 77 1 90 1 72 2 477 73 3
GRIFFINS 68 2 26 FAIL 51 3 46 4 59 3 77 1 70 2 60 2 385 57 1 HARRISON58 3 12 FAIL 34 FAIL 54 3 55 3 71 2 75 1 40 4 353 50 25
ROSTEN 78 1 42 4 45 4 58 3 74 2 63 2 85 1 80 1 438 66 7
VICTOR 78 1 56 3 60 2 56 3 59 3 83 1 85 1 24 FAIL 421 63 9
GABRIEL 48 4 38 FAIL 33 FAIL 52 3 40 4 49 4 75 1 12 FAIL 302 43 28
The card works like this . a teacher will enter the mark for a pupil then it will calculate the grade ie 1-9(fail). and also calculates the best 6 subjects including english as shown in the 3rd last column.(SUM(LARGE(E3:Q3,{1,2,3,4,5}))+C3)
i want to now add a column that will calculate the points (sum of best grade). i have tried alot of formulars but the challenges comes because the grades where found by a formular and are not in a range (in different columns)
=SUM(SMALL(range,{1,2,3,4,5}))+M34 - this formular isnt giving an answer but an error ### #num!. am stuck on how to go about it. i noticed it could be because the grades for a particular pupil are in different columns and are a result of a formular.
Please help. Thanks in advance
Hi Fazal,
Good day…
A very nice article, thanks for sharing.
“For some reason SUMIF don’t work if we don’t put criteria in inverted commas. If I find the reason I will let you know. And someone out there know the reason please share in the comment section”
I would like to add tgat excel help says:
Criteria is the condition that must be met if a value is to be included in the sum. If the condition contains any text, logical or mathematical symbols it must be enclosed in double quotation marks. Quotation marks are not necessary if the criterion is just a number.
Regards,
Khalid
what to do if i want to get the sum of large “N” numbers from multiple worksheets.
Thanks in advance
Hi Hasaan,
I have a question about how to take the next step in conditional summarising , I would like to summarise volume by highest Profit not by highest volume, to arrive at the last column here. The column was done manually.
I’m trying to make sales fall into the profitability categories: 50 best transactions, next 25 best transactions etc.
I will use three if statements to achieve the category name, but the summation of volumes based in highest profit eludes me. Do you have an idea? I can’t sort the data set because I have 4 quarters to do.
The data set is very large, but this gives a good indication:
Profit Vol Rank Cumulative sales by highest profit
What Q1 Q1 Q1 Q1
Goods 1 350000 53 1 0-50
Goods 1 40000 7 4 75-100
Goods 1 100000 17 2 50-75
Goods 1 20000 3 8 75-100
Goods 1 70000 5 3 50-75
Goods 1 26000 4 5 75-100
Goods 1 -10000 19 11 75-100
Goods 1 20000 3 7 75-100
Goods 1 22000 5 6 75-100
Goods 1 5500 1 9 75-100
Goods 1 -500 0 10 75-100
Hi,
I have a similar issue that I cant find a good solution too without creating new columns of data. I have two columns, A and B. I want to find the average of the top three values in column B given that the condition X in column A is met at the same time. I have tried all kinds of formulas but I can’t seem to get it right.
Your help is very much appreciated!
Hello, I wanted to do a Conditional TOP N Items Sum… I have a Column A where i have City Name (27 Cities), Column B Where an Establishment Name, Column C where Order Qty. Its a huge list of 32000 Establishment. Now i want to know the Order Qty of Each of the 27 City from the top 10 Ordering Establishments. How Can i do that. I have gone through this but could not make use of it.
Hey Ruchir - I had a similar problem, one workaround is to first use Sort the dataset by col A and then use Find & Replace (Ctrl+H).
After sorting, add a Subtotal to your dataset through the Data tab on the Ribbon - could be anything, but let’s use COUNT for the example. At every change in City Name, put a count on Col C, i.e. Order Quantity.
Now, find and replace all the = signs on the sheet with a blank. I will essentially use find and replace to alter the formula to give us the the results, so removing the blank prevents any errors through the process - we’ll bring it back in the end 🙂
Now find and replace all the ) signs with ,{1,2,3,4,5,6,7,8,9,10})). After this, find and replace all the SUBTOTAL(3, with =SUM(LARGE(
I think that should solve it 🙂
Cheers,
Vasudha
*is to first sort the dataset