Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, and 2013. If you are using an earlier version (Excel 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Excel, click here: Adding Up Tops and Bottoms.

Adding Up Tops and Bottoms

by Allen Wyatt
(last updated May 29, 2017)

5

As you are collecting data for your Excel project, you may have a need to add up the top N number of values in a range or the bottom N number of values. For instance, you may be keeping track of golfing scores and need to add up only the top three scores or the bottom three scores out of a series of scores.

As with most any Excel problem, there are several ways you can go about implementing a solution. For instance, you could sort the scores so that they are in ascending or descending order. You would then have the top or bottom scores in a set place where you could always sum them.

There is an easier way, however. You can use the LARGE and SMALL functions, which do the job very nicely. For instance, say you have the scores in cells C5 through C25. All you need to do is put the following formula in a cell in order to add up the top three scores:

=LARGE(C5:C25,1)+LARGE(C5:C25,2)+LARGE(C5:C25,3)

The function returns the Nth largest value from the specified range. As shown in the formula, the largest, second largest, and third largest values are returned and added together. You can similarly use the SMALL function to sum the three lowest scores:

=SMALL(C5:C25,1)+SMALL(C5:C25,2)+SMALL(C5:C25,3)

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (12595) applies to Microsoft Excel 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Excel here: Adding Up Tops and Bottoms.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Removing Specific Fields

Word allows you to place all sorts of fields in your documents. If you want to search for only specific types of fields, then ...

Discover More

Comma-Delimited and MS-DOS CSV Variations

Excel provides different file formats you can use to export your worksheet information. One such file format is CSV, or comma ...

Discover More

Finding and Deleting Rows

Got a table that contains rows you want to delete? Deleting one or two rows in a table is easy; deleting a bunch of rows that ...

Discover More

Professional Development Guidance! Four world-class developers offer start-to-finish guidance for building powerful, robust, and secure applications with Excel. The authors show how to consistently make the right design decisions and make the most of Excel's powerful features. Check out Professional Excel Development today!

More ExcelTips (ribbon)

Indirectly Referencing a Cell on a Different Worksheet

Excel includes the powerful INDIRECT function which can be used to assemble references to other cells in your workbook. ...

Discover More

Removing Dashes from ISBN Numbers

ISBN numbers are used to denote a unique identifier for a published book. If you remove the dashes included in an ISBN, you ...

Discover More

Summing Only Positive Values

If you have a series of values and you want to get a total of just the values that meet a specific criteria, then you need to ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 8Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 7 - 0?

2017-05-30 09:54:08

Russell

Alternative formulae which are less cumbersome to write with larger N would be

=SUM(LARGE($C$5:$C$25,{1,2,3}))
and
=SUM(SMALL($C$5:$C$25,{1,2,3}))

To change the number of values summed, just add or subtract from the {1,2,3}
(Unlike an array formula, the curly braces have to be typed in from the keyboard and there is no need to use Ctrl-Shift-Enter)


2017-05-30 05:01:23

Russell

Alternative formulae which are less cumbersome to write with larger N would be

=SUM(LARGE($C$5:$C$25,{1,2,3}))
and
=SUM(SMALL($C$5:$C$25,{1,2,3}))

To change the number of values summed, just add or subtract from the {1,2,3}
(Unlike an array formula, the curly braces have to be typed in from the keyboard and there is no need to use Ctrl-Shift-Enter)


2013-04-22 08:45:40

Linda

Thanks Dave


2013-04-22 04:24:24

Dave Kerr

Hi Linda,

Yes, this works fine for duplicates. Try this small example for test or experimentation...

In a blank worksheet, I entered the following twelve values in Cells A4 to A15:
21, 18, 20, 21, 17, 5, 16, 10, 2, 6, 17, 5

To the right, in Column C, I entered the formula
=LARGE($A$4:$A$15,1)
This returns the value 21.

Drag it down two cells and change the parameter value to 2 and 3 respectively.
You should get a second 21 and a 20. So, duplicates are handled no problem. The same applies if you replace LARGE by SMALL.

To simplify the addition element, you can incorporate the task into a shorter function, rather than adding the three LARGE formulae results.

In a blank cell, enter the formula:
=SUMIF(A4:A15,">=" & LARGE(A4:A15,3))

In my example you should get a result of 62. Excel evaluates the LARGE function to find the third largest value, in this case 20. The SUMIF then adds any values greater-than-or-equal-to this value.

NOTE:
If you have, for example, five cells all with the value 21, then the SUMIF formula will return a misleading value of 105. You will then need to stay with the sum of the three LARGE formulae to get the correct answer. My SUMIF works very well with unique data values.

Allen's tip is especially useful if you are not in a position to sort the data, e.g. to help identify duplicates.

I hope I haven't confused you!


2013-04-20 09:38:52

Linda

Can this formula handle ties or duplicate values.


This Site

Got a version of Excel that uses the ribbon interface (Excel 2007 or later)? This site is for you! If you use an earlier version of Excel, visit our ExcelTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.