Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Evaluating last character of a string with IF function

Posted on 2010-09-13
4
Medium Priority
?
314 Views
Last Modified: 2012-08-13
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
Comment
Question by:greentatertot1970
4 Comments
 
LVL 13

Accepted Solution

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

Assisted Solution

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

Expert Comment

by:Tracy
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

by:greentatertot1970
ID: 33662678
Perfect - thank you both!
0

Featured Post

Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Graphs within dashboards are meant to be dynamic, representing data from a period of time that will change each time the dashboard is updated with new data. Rather than update each graph to point to a different set within a static set of data, t…
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question