Trimming cell contents?

J

Jeremy Turner

Hi

I have a column of cells each containing a 4 digit number. Is there any way
I can trim the left digit dependant upon certain conditions.

If the left digit of each 4 digit number equals either "1" or "2" I want to
trim this away. If the original 4 digit number ends in anything other than
"1" or "2" I want to leave the original 4 digit number unaltered.

For example:

1231 would become 123
1232 would become 123
1234 would stay as 1234

Any help on this is really appreciated.

Many thanks in advance

Jem
 
B

Bob Phillips

See response in excel.misc

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
M

Mallycat

I'm sure I have answered this somewhere else

=IF(OR(LEFT(E11,1)="1",LEFT(E11,1)="2"),RIGHT(E11,3),E11)

Mat
 
J

Jeremy Turner

Thanks so much for the prompt response. I must apologise for crossposting
to the other Excel groups but I have to confess that I wasn't sure which
group I should post in.

Thanks again

Jem
 
B

Bob Phillips

Jeremy,

If you want to hit many groups, do them all in the same message. When we
read them they then get read in all groups.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top