# Count visible rows in a filtered list

=SUBTOTAL(3,range)

To count the number of visible rows in a filtered list, you can use the SUBTOTAL function. In the example shown, the formula in cell C4 is:

=SUBTOTAL(3,B7:B16)

The result is 7, since there are 7 rows visible out of 10 rows total.

In this example, the goal is to count rows that are visible and ignore rows that are hidden. This is a job for the SUBTOTAL function. SUBTOTAL can perform a variety of calculations like COUNT, SUM, MAX, MIN, and more. What makes SUBTOTAL interesting and useful is that it *automatically ignores items that are not visible in a filtered list or table*. This makes it ideal for running calculations on the rows that *are visible* in filtered data.

### Count with SUBTOTAL

Following the example in the worksheet above, to count the number of non-blank rows visible when a filter is active, use a formula like this:

=SUBTOTAL(3,B7:B16)

The first argument, *function_num*, specifies count as the operation to be performed. SUBTOTAL ignores the 3 rows hidden by the filter and returns 7 as a result, since there are 7 rows visible.

Note that SUBTOTAL *always* ignores values in cells that are hidden with a filter. Values in rows that have been "filtered out" are never included, regardless of *function_num*. If you are hiding rows manually (i.e. right-click > Hide), and not using filter controls , use this version of the formula instead:

=SUBTOTAL(103,B7:B16)

With the *function_num* set to 103, SUBTOTAL still performs a count, but this time it will ignore rows that are manually hidden, as well as those hidden with a filter. To be clear, values in rows that have been hidden with a filter are *never* included, regardless of *function_num*.

*The SUBTOTAL function can perform many other calculations. To see a list of all the calculations SUBTOTAL can perform, see this page.*

## Excel Formula Training

Formulas are the key to getting things done in Excel. In this accelerated training, you'll learn how to use formulas to manipulate text, work with dates and times, lookup values with VLOOKUP and INDEX & MATCH, count and sum with criteria, dynamically rank values, and create dynamic ranges. You'll also learn how to troubleshoot, trace errors, and fix problems. Instant access. See details here.

## Download 100+ Important Excel Functions

Get over 100 Excel Functions you should know in one handy PDF.