I have a table of filtered data. For example

a1: 15
a2: 18
a10: 15

cells a3:a9 also have valid numbers but are filtered out.

Is there a way to count the frequency of only the filtered data.

For example in the above, value 15 has a frequency of 2, 18 only one.

Countif calculates the frequency of all rows, not just the visible ones.
Subtotal with option 2 counts the number of visible rows, in this case 3.

Thanks