How to count any text in non contiguous cells in Google Sheets?

Viewed 18

I've tried all the formulas I found in a Google search and they don't work.

I'm trying to count non-contiguous cells that contain any text. So, there may be unique text strings in H8, H4, and H9 and the answer should be 3. Or, there may be unique text strings in H2:H5 and in H7 and H9 and that answer should be 6.

What is the formula? Many thanks!

2 Answers

Use this formula

=ArrayFormula(IF(H2:H="",,COUNTIF(H2:H, "="&H2:H)))

enter image description here

try in row 2:

=INDEX(IF(H2:H="";;COUNTIF(H2:H; H2:H)))
Related