How to count filtered rows in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
To count filtered rows in Excel, use a function designed to consider only visible cells. Regular COUNT or COUNTA functions include hidden rows, so a different approach is required.
Using the SUBTOTAL Function
SUBTOTAL counts only visible rows after applying a filter.
-
Click on the cell where you want the count.
-
Enter the formula:
\(=SUBTOTAL(103, A2:A100)\)
-
103is the function number for counting visible, non-empty cells. -
A2:A100is the range of cells you want to count. Adjust this range as needed.
-
-
Press Enter. The result displays the number of filtered rows that are visible.
Notes:
-
Use
102instead of103to count numeric values only. -
The function automatically updates when you change the filter.
Example
If you have a table of 50 employees and filter by "Department = Sales," =SUBTOTAL(103, B2:B51) counts only employees in the Sales department that are currently visible.
Using the AGGREGATE Function (Alternative)
AGGREGATE is more flexible and works similarly to SUBTOTAL.
-
Select the cell for the count.
-
Enter the formula:
-
3is the function number forCOUNTA. -
5ignores hidden rows. -
A2:A100is the range of interest.
-
-
Press Enter. The formula counts only filtered, visible rows.
Difference Between Windows and Mac:
-
SUBTOTALworks identically on both platforms. -
On Mac, ensure that the range does not include entire column references like
A:Afor filtered data. Use a specific range likeA2:A100for accurate results.
Tips
-
Place the count cell outside the filtered range to avoid accidental inclusion in the filter.
-
Combine
SUBTOTALwith other Excel functions to count specific criteria within visible rows.
This method ensures accurate counting of visible, filtered rows while ignoring hidden or collapsed data.
. Was this Helpful?Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1