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, which automatically ignores rows that are hidden by a filter. In the example shown, the formula in cell C2 is:
=SUBTOTAL(3,B5:B14)
The SUBTOTAL function can perform calculations like COUNT, SUM, MAX, MIN, and more. What makes SUBTOTAL especially interesting and useful is that it automatically ignores items that are not visible in a filtered list or table. This makes it ideal for showing how many items are visible in a list, the subtotal of visible rows, etc.
Following the example in the image above, to count the number of non-blank rows visible when a filter is active, use:
=SUBTOTAL(3,B5:B14)
If you are hiding rows manually (i.e. right-click, Hide), and not using the auto-filter, use this version instead:
=SUBTOTAL(103,B5:B14))
The first argument controls the type of operation SUBTOTAL will perform. For a full list, see the table here.
Download 200+ Excel Shortcuts
Get over 200 Excel shortcuts for Windows and Mac in one handy PDF.