I have a column of hospital names. In most of them, the last three characters are "-" and the two-letter abbreviation for the state, e.g. "-CA". but some (out of hundreds) have the state name somewhere in the hospital name, e.g. "Texas Tech U Affil-Lubbock" or "Community Health of South Florida".
I'm trying to find a way to make Excel give the last two characters only if the 3rd character from the right is a dash ("-"), but trying to specify that character position seems impossible.
I tried:
=IF(RIGHT(H4,-3)="-",RIGHT(H4,2),"noabbrev") and get #VALUE
=IF(RIGHT(H4,3)="-??",(RIGHT(H4,2)),"noabbrev") and always get noabbrev for all cells
At this point, I fear I need to use =RIGHT(H4,2) in order to get the bulk of the cells correctly and eyeball/correct the errors by hand.
Am I missing the obvious again?
Aucun commentaire:
Enregistrer un commentaire