COUNTIF to count last 4 letters in string

  • Thread starter Thread starter davegb
  • Start date Start date
D

davegb

I'm trying to figure out how to count the occurences of the text
"cnty" in a column of text. "cnty" will always be the last 4
characters to the right. Can anyone help me here?
Thanks in advance.
 
You can use the formula (adjust the range to suit your circumstances...

=SUMPRODUCT(--(RIGHT(A1:A100,4)="cnty"))

Rick
 
With values (or blanks) in cells A1:A20

This formula counts the cells ending with "cnty":
B1: =COUNTIF(A1:A20,"*cnty")

Note: the asterisk (*) is a wildcard meaning: zero or more characters.

Does that help?

Regards,

Ron
Microsoft MVP - Excel
 
Back
Top