Evaluating last character of a string with IF function

I am sure that there is a way to do this but it is not clear to me how...

I am using an IF statement. I would like the logical_test parameter to evaluate a strings last character.


=IF(A1 end with a "T","String 1","String 2")
Who is Participating?
MWGainesJRConnect With a Mentor Commented:
=IF(right(A1,1)="T","String 1","String 2")
CluskittConnect With a Mentor Commented:
=IF(RIGHT(A1,1)="T","String 1",String 2")
TracyVBA DeveloperCommented:
In case there are any extraneous spaces add the end of your string, you may want to use the Trim function to remove them, and then compare the actual last character:

=IF(RIGHT(TRIM(A1),1)="T","String 1","String 2")
greentatertot1970Author Commented:
Perfect - thank you both!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.