The simplest solution in such instances is to use a 1/0 index to indicate visible status... eg - in a blank column on row 7 (we'll assume Z for sake of demo.)
Z7: =SUBTOTAL(103,H7)
copied down for all rows (to Z21)
Your COUNTIF thus becomes a SUMIF
=SUMIF($H$7:$H$21,"Yes",$Z$7:$Z$21)
the above will thus identify all Yes' visible or not but the value in Z will only 1 where the row is visible (ie Yes/invisible -> 0)
Alternatives involve SUMPRODUCT/SUBTOTAL & OFFSET... the above index is obviously simpler and may prove useful for other calcs also.
Bookmarks