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 Displayed Cells.

Counting Displayed Cells

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


The filtering capabilities of Excel make it easy to display just the information that you want from a data table. How you use filtering has been discussed in other issues of ExcelTips. Once you've applied a filter to your data, you may want to use a function to display the number of cells that are displayed in a filtered range.

If you just need to quickly know the count, highlight the filtered range, right-click anywhere on the status bar, and choose Count from the resulting Context menu. Excel displays, in the status bar, the number of cells displayed in the range you selected.

If you need a solution that you can use in a formula, you should look towards the SUBTOTAL function. This function provides a number of different "subtotal" results, but it only operates on data that is displayed. This means that the information filtered out by AutoFilter won't count in what SUBTOTAL returns.

The general syntax of the SUBTOTAL function is as follows:

=SUBTOTAL(type,range)

All you need to do is specify a type and a range. The range part should be easy: it is just a standard range. The type specifier can be a number between 1 and 11, as follows:

Type Function Performed
1 AVERAGE
2 COUNT
3 COUNTA
4 MAX
5 MIN
6 PRODUCT
7 STDEV
8 STDEVP
9 SUM
10 VAR
11 VARP

Notice that the type specifier you use indicates what Excel function is applied to the displayed results. Thus, if you want to determine the count of the filtered results in the range of F3:F27, you would use a type specifier of 2, as follows:

=SUBTOTAL(2,F3:F27)

This usage will, of course, count numeric values in the range specified. If you want to count text values, then you should use a type specifier of 3 so that Excel relies on the COUNTA function instead.

You should also know that you can use type specifiers in the range of 101 to 111; they are the same as the specifiers listed above, but only have 100 added to them. The difference is that the values 1 through 11 operate on all cells, whereas the values 101 through 111 operate on only the non-hidden cells.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (10694) 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 Displayed Cells.

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

IEEE Citation Format

Different style guides describe different ways of formatting information that appears in a document. One such style guide ...

Discover More

Listing the Settings in a Template

Templates allow you to define and collect many formatting settings that control how your documents appear. Getting a ...

Discover More

Calculated Dates

Word makes it easy to insert today's date in a document, but not as easy to insert a date X number of days in the future. ...

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)

Converting to Other Number Systems

Most calculations are done using the decimal numbering system. If you need to convert your decimal values to a differing ...

Discover More

Using the XIRR Function

One of the financial worksheet functions provided in Excel is the XIRR function. This is used to figure out an internal ...

Discover More

Returning an ANSI Value

Need to know the character value of the first character in a string? It's easy to do, without using a macro, by using 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?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.