Solved

# Evaluating last character of a string with IF function

Posted on 2010-09-13
307 Views
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
Question by:greentatertot1970

LVL 13

Accepted Solution

MWGainesJR earned 250 total points
ID: 33662524
=IF(right(A1,1)="T","String 1","String 2")
0

LVL 18

Assisted Solution

Cluskitt earned 250 total points
ID: 33662534
=IF(RIGHT(A1,1)="T","String 1",String 2")
0

LVL 24

Expert Comment

ID: 33662618
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

Author Closing Comment

ID: 33662678
Perfect - thank you both!
0

## Featured Post

### Suggested Solutions

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.