View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld
 
Posts: n/a
Default Function to extract numbers from an alphanumeric cell

On Fri, 10 Mar 2006 06:17:27 -0800, diana
wrote:

Is there a function that will read the numbers only of an alphanumeric cell:
Cell that contains a word and number.
Appreciate anybody's help in this respect.


Here's one way that will also give you a bunch of other useful functions.

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

Then use this formula:

=REGEX.SUBSTITUTE(A1,"[^0-9]")

With this "regular expression" anything that is not a number will be replaced
with nothing. So the numbers can be any place in the alpha numeric string.

[^0-9] matches anything in the string that is not in the range of 0-9.

If your needs are different, the expression can be (usually) easily modified to
accomplish that.


--ron