Generic characters


Posted by A Miller on September 11, 2001 10:58 AM

How do I get one cell to only look at the last number of a string. I have one column(1) that looks to another(2). The data in column two is 10 characters long but I am only interested in the last character. I want column 1 to look at column 2 and if the last character in column 2 is a "1" then I want a "NG" to appear else "". I tried using "?1" and I tried using "?????????1" but it didn't seem to work. I'm probably way off so any help would be greatly appreciated.

Posted by Barrie Davidson on September 11, 2001 11:46 AM

Try using
=IF(RIGHT(B1,1)="1","NG","")

BarrieBarrie Davidson

Posted by Aladin Akyurek on September 11, 2001 11:48 AM

=IF(RIGHT(A1)+0=1,"NG","")

Aladin

Posted by Cliff on September 11, 2001 3:04 PM

What does the +0 signify? Is it equivalent to =IF(RIGHT(A1)="1","NG","")?

Thanks,
Cliff

Posted by Aladin Akyurek on September 11, 2001 3:21 PM


> What does the +0 signify?
Cliff,

RIGHT produces a text value. Since 1 can be treated as number, I add up zero to to the result of RIGHT to get 1 as a number value by coercion, so I can test the coerced result of RIGHT if it's equivalent to 1, avoiding using "1".

>Is it equivalent to =IF(RIGHT(A1)="1","NG","")?

Yes.

Aladin



Posted by Cliff on September 12, 2001 2:31 PM

Thanks, Aladin. I thought it mught be something along those lines.

Cliff