SUBTOTAL works like this - SUBTOTAL(function_num,Range1,range2,...)
where function_num is a number that telling what you want subtotal to do
For function_num, use single digit code 1-11 to includes manually hidden values, and use three digits code 101-111 to ignore manually hidden values, whereas filtered out values are always ignored.
1 101 AVERAGE
2 102 COUNT
3 103 COUNTA
4 104 MAX
5 105 MIN
6 106 PRODUCT
7 107 STDEV
8 108 STDEVP
9 109 SUM
10 110 VAR
11 111 VARP
And at least one range should be there.
So, put a Filter on the column of "Yes", so that only "Yes" cells are visible, rest get filtered out.
As you want only the first value, the Yes value, to ignore hidden values, you need use subtotal only in the numerator. In the denominator, you want to count all values, including what is filtered out, so there subtotal is not required, a normal count will do the work.
Enter his formula:
=Subtotal(2,H2:H9998)/Count(H2:H9998)
As your actual data is not here, I can't try myself. But please try and if you face any difficulty, please make a comment here, I will look and reply.