This is a job for theSUBTOTAL function.
SUBTOTAL can perform a variety of calculations like COUNT, SUM, MAX, MIN, and more.
This makes it ideal for running calculations on the rows thatare visiblein filtered data.
Count with SUBTOTAL
The first argument,function_num, specifies count as the operation to be performed.
Note that SUBTOTALalwaysignores values in cells that are hidden with a filter.
Values in rows that have been “filtered out” are never included, regardless offunction_num.
If you are hiding rows manually (i.e.
To be clear, values in rows that have been hidden with a filter areneverincluded, regardless offunction_num.
The SUBTOTAL function can perform many other calculations.
To see a list of all the calculations SUBTOTAL can perform,see this page.