fix the div 0 first
if(iserror(your formula),0,your formula)
then use
something like
=SUM(A1:A100)/(SUMPRODUCT(--(A1:A100<>0)))