I was researching a way to count the number of zeroes in a column of data, even if the data gets filtered. I found the following solution:
=SUMPRODUCT(SUBTO
=SUMPRODUCT(SUBTOTAL(3,OFFSET(Sheet1!$A$1:$A$1006,ROW(Sheet1!$A$1:$A$1006)-MIN(ROW(Sheet1!$A$1:$A$1006)),,1)),ISNUMBER(SEARCH(B861,Sheet1!$A$1:$A$1006))+0)
B861 is what ever cell you are referencing.