Link to home
Start Free TrialLog in
Avatar of greentatertot1970
greentatertot1970Flag for United States of America

asked on

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")
ASKER CERTIFIED SOLUTION
Avatar of MWGainesJR
MWGainesJR
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Tracy
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")
Avatar of greentatertot1970

ASKER

Perfect - thank you both!