How do you count cells with a certain partial string?

gigawatts picture gigawatts · Nov 5, 2013 · Viewed 16.3k times · Source

I have cells with dates that are formatted in different ways (and too messy to re-format, also lots of data) but if I want to count how many dates are in October, for example, I was hoping to do a COUNTIF() or COUNTA(FILTER()) but I'm not sure how to search the cell for the partial string 10/ (this is the only unique combination of characters that I can think of that would ID only the correct month).

Answer

Vasim picture Vasim · Nov 6, 2013

You can use * wild character, the wild character before the value means anything ending with and at the end means anything starting with...

=COUNTIF(A1:A10,"*10/*") - Has the text 10/ anywhere in the cell

=COUNTIF(A1:A10,"*"&B1&"*") - Cell B1 has the finding text

=COUNTIF(A1:A10,"10/*") - Has the text 10/ at start

=COUNTIF(A1:A10,"*10/") - Has the text 10/ at end