how do I eliminate leading "0s" in an alpha numeric cell

G

Guest

I have ID numbers that are alpha numeric. Some are all numeric formatted as
text, others are actual alpha numeric combinations. Most all have leading
"0s". I was hoping I would be able to use a function in a formula to easily
eliminate them.
 
R

Ron Rosenfeld

I have ID numbers that are alpha numeric. Some are all numeric formatted as
text, others are actual alpha numeric combinations. Most all have leading
"0s". I was hoping I would be able to use a function in a formula to easily
eliminate them.

Give some examples of the values.

If the values only include numbers, you can remove the leading zeros with a
formula:

=--A1

That will convert the value to a number and the appearance will depend on the
formatting of the cell. If the format is General, no leading zeros will
appear.

If the value might contain both numbers and letters, and you want to strip off
the leading zeros, then one way would be to use this **array** formula:

=MID(A1,MATCH(FALSE,"0"=MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1),0),255)

To enter an array formula, hold down <ctrl><shift> while hitting <enter>.
Excel will place braces {...} around the formula.

OR

you could download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/ and use the Regular Expression formula:

=REGEX.MID(A1,"[^0].*")


--ron
 

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