Please Note: This article is written for users of the following Microsoft Excel versions: 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. 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: Counting with Subtotals.

Counting with Subtotals

Written by Allen Wyatt (last updated May 12, 2023)
This tip applies to Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365


1

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. Display the Data tab of the ribbon.
  5. In the Outline group click the Subtotal tool. Excel displays the Subtotal dialog box. (See Figure 1.)
  6. Figure 1. The Name/State Fields of the Subtotal dialog box.

  7. 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.
  8. The Use Function drop-down list should be set to Count.
  9. Using the list in the Add Subtotal To box, choose the columns to which subtotals should be added.
  10. Make sure the Summary Below Data check box is selected.
  11. Click on OK.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (8035) applies to Microsoft Excel 2007, 2010, 2013, 2016, 2019, and Excel in Microsoft 365. You can find a version of this tip for the older menu interface of Excel 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

Inserting the Document Revision Number

Need to know how many times your document has been saved? Word keeps track of this information, and makes it easily ...

Discover More

Floating Information in a Frozen Row

You can freeze information in rows or columns using one of the built-in features of Excel. As you move up or down in the ...

Discover More

Counting Words

Do you need to know how many words are in a range of cells? Excel provides no intrinsic way to count the words, but you ...

Discover More

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

More ExcelTips (ribbon)

Inserting a Sound File in Your Worksheet

Some worksheets are better understood through the spoken word or with musical accompaniment. Sound files can be easily ...

Discover More

Using Custom Add-Ins

Once you've created your custom add-in, you need to know how you or other people can use it. Here are the simple steps to ...

Discover More

Resolving Revisions

You've reviewed the changes that were made to your workbook using the Highlight Changes tool. Now you need to remove the ...

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}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. 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 1 + 1?

2023-07-05 09:31:49

Billy Thomas

To Count when using the SUM function. put a"1" in each cell in an inserted or added column or use an existing column that has unneeded data. Then add the SUM Subtotal to that column also. The result will be the columns you want to sum, plus the count in the column of 1's.


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.