Formula to remove all non-numeric characters from a cell

M

Mr. Moxie

I have a cell of data that has a combination of numeric characters, special
characters and some alphas... I would like a formula that will strip out
all the characters, and just leave the numbers. Can anyone help?

For example... if a cell contained 'A12(C)-*3%4', I would like the formula
to return '1234'.

Thank you in advance for any help!
D.
 
R

Ron Rosenfeld

I have a cell of data that has a combination of numeric characters, special
characters and some alphas... I would like a formula that will strip out
all the characters, and just leave the numbers. Can anyone help?

For example... if a cell contained 'A12(C)-*3%4', I would like the formula
to return '1234'.

Thank you in advance for any help!
D.

What was the problem with the responses given you in microsoft.public.excel an
hour or so before you posted this second request?

One method:

Download and install Longre's free morefunc.xll add-in from
http://xcell05.free.fr/

Then use this formula:

=REGEX.SUBSTITUTE(A1,"\D")

The formula will return the digits as a text string. If you need the result as
a "number", then precede the formula with a double unary to convert it:

=--REGEX.SUBSTITUTE(A1,"\D")

--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