The easiest way to count the number of filtered rows in Google Sheets is to use the following syntax:
Note that the value 102 is a shortcut for taking the count of a filtered range of rows.
The following example shows how to use this function in practice.
Example: Count Filtered Rows in Google Sheets
Suppose we have the following spreadsheet that contains information about various basketball teams:
To add a filter to this data, we can highlight cells A1:B10, then click the Data tab, then click Create a filter:
We can then click the Filter icon at the top of the Points column and uncheck the box next to the first three values 84, 89, and 93:
Once we click OK, the data will be filtered to remove these values.
If we attempt to use the COUNT() function to count the number of filtered rows, the value will not be correct:
The number of filtered rows is 6, but the COUNT() function returns 7.
Instead, we need to use the SUBTOTAL() function:
This function only counts the number of visible rows.
We can manually verify this is correct by observing that there are 6 visible rows.
The following tutorials explain how to perform other common operations in Google Sheets: