Alternate non-array formula:
=SUMPRODUCT((A1:A10<>"")/COUNTIF(A1:A10,A1:A10&""))
And I'm not sure what you mean by second range. You want to apply the formula to C10:C20 instead of A1:A10?