How do I count not equal to wildcard characters in Excel?

Kim picture Kim · Jul 2, 2012 · Viewed 11.3k times · Source

Using COUNTIF(range,"<>") can I count non-empty cells and with COUNTIF(range,"~?") or COUNTIF(range,"~*") can I calculate the number of cells matching a wildcard character, but can I do it with one COUNTIF() ?

COUNTIF(range,"<>~?") does not work.

Answer

Siddharth Rout picture Siddharth Rout · Jul 2, 2012

Using COUNTIF(range,"<>") can I count non-empty cells

You can use COUNTA() to Count Non Empty Cells.

=COUNTA(A1:A10)

If you still want to use COUNTIF() then yes, you can use it like

=COUNTIF(A1:A10,"<>")

You can use wildcards to count for cells which have specific words like this

=COUNTIF(A1:A10,"Kim*")   '<~~ Starts with "Kim"
=COUNTIF(A1:A10,"*Kim*")  '<~~ Contains "Kim"
=COUNTIF(A1:A10,"*Kim")   '<~~ Ends with "Kim"

To count Not Equal to With WildCards, you can use this

=COUNTIF(A1:A10,"<>Kim*")   '<~~ Doesn't Start with "Kim"