Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Counting with Subtotals.

Counting with Subtotals

by Allen Wyatt
(last updated June 14, 2014)

3

Suppose that you have two adjacent columns of data. In the first column you have a list of names and in the second column a list of states. If you want to find out how many people live in each state, you can use the subtotaling features of Excel. To use this feature to answer your query, follow these steps:

  1. Make sure there are column heads on each column, such as "Name" and "State." (The subtotaling feature requires the presence of column heads.)
  2. Sort the columns by the values in the second (states) column.
  3. Make sure one of the cells is still selected in either of the columns.
  4. Choose Subtotals from the Data menu. Excel displays the Subtotal dialog box. (See Figure 1.)
  5. Figure 1. The Subtotal dialog box.

  6. Make sure the At Each Change In drop-down list is set to State. (Use the name of the second column.) This indicates where Excel will insert subtotals.
  7. The Use Function drop-down list should be set to Count.
  8. Using the list in the Add Subtotal To box, choose the columns to which subtotals should be added.
  9. Make sure the Summary Below Data check box is selected.
  10. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2750) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Counting with Subtotals.

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

Adding an AutoText Entry

Creating custom AutoText entries is not only extremely helpful, but very easy. This tip explains how.

Discover More

Backing Up Label Layouts

Once you create a custom label layout it is a good idea to backup the layout on a different hard drive in the event of a ...

Discover More

Incorrect Links after Sorting Hyperlinks

When you sort your data you should always check to see if the sort was done correctly. What if sorting messes up hyperlinks ...

Discover More

Program Successfully in Excel! John Walkenbach's name is synonymous with excellence in deciphering complex technical topics. With this comprehensive guide, "Mr. Spreadsheet" shows how to maximize your Excel experience using professional spreadsheet application development tips from his own personal bookshelf. Check out Excel 2013 Power Programming with VBA today!

More ExcelTips (menu)

Using Subtotals and Totals

You can insert subtotals and totals in your worksheets by using either a formula or specialized tools. This tip explains how ...

Discover More

Copying Subtotals

If you have added subtotals to your worksheet data, you might want to copy those subtotals somewhere else. This is easy to do ...

Discover More

Excel Refuses to Put Page Breaks between Subtotal Groups

Page breaks not appearing where you expect them in your subtotaled data? It could be because of a setting you made in your ...

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 0 + 7?

2014-06-16 11:59:05

Hank Jager

Would it not be easier to use the =Countif(Range,"Selection") method/


2014-06-16 11:54:24

Scott Renz

This helped me in that my company sends out monthly per cent of training complete reports. I could never find myself in them as the report was broken down by employees under a manager under a manager. I had not realized that the reason there were numbers and plus signs in the left margain to the left of the row numbers was because a range had been "subtotalled." When I tried your subtotal tip on some other data, I then saw the same phenomenom in the left margain and realized I could now see my name on the other sheet by removing subtotals. Now I know what all those numbers and pluses on the margain are all about and how to put them there or remove them. Thanks.


2014-06-15 15:23:14

Bill

I performed this function (to the letter, I thought). My counts all show as zero? Why?
It is a list of cities and states and the states are in order. Excel 2000.


This Site

Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon 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.