• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

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.

EXAMPLE:

=IF(A1 end with a "T","String 1","String 2")
0
greentatertot1970
Asked:
greentatertot1970
2 Solutions
 
MWGainesJRCommented:
=IF(right(A1,1)="T","String 1","String 2")
0
 
CluskittCommented:
=IF(RIGHT(A1,1)="T","String 1",String 2")
0
 
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")
0
 
greentatertot1970Author Commented:
Perfect - thank you both!
0
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.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now