Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for an "if" - "then" statement PLEASE 1

Status
Not open for further replies.

PeanutB7

Programmer
Jun 13, 2005
56
US
I am attempting to go through a large spreadsheet with a first column containing 12 digit id numbers. Within the 12 digit number is an identification trailer on the very last digit. I would like to sort the spreadsheet by grouping any 12 digit id number that ends in 1, 2 or 3. If I had an if then statement that could assign a 1 to the next column that would work great. I could sort easily by the next column of assigned 1's. It does not matter whether the last digit is a 1, 2 or 3 only that I seperate it from the remaining rows of data. Could someone please help! Thank you in advance!
 
How about adding one column?
put this formula in the cells of said last column:
Code:
=Right(A1,1)
Then you'll have the identifier in that last column and you could simply AutoFilter it...

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
I don't see why you need an IF.

Just pick out that one character and sort to group 1, 2 and 3 together.

[tab]=Mid(A1,12,1)

That will return the 12th character from the cell.

FYI: If you really wanted to go further and use an IF, then it would look something like this:

=If(Or(Mid(A1, 12, 1) = 1, Mid(A1, 12, 1) = 2, Mid(A1, 12, 1) = 3), "PICK ME!!", "")

[tt]_____
[blue]-John[/blue][/tt]
[tab][red]The plural of anecdote is not data[/red]

Help us help you. Please read FAQ 181-2886 before posting.
 
or another way

=IF(VALUE(RIGHT(A1,1))<=3,1,VALUE(RIGHT(A1,1)))

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Thank you so very much John your suggestion worked perfect.

Have a great day,

JB
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top