View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
snowball snowball is offline
external usenet poster
 
Posts: 4
Default Extracting 7 digit number from alphanumeric string

Hi,

I'm trying to extract a 7 digit number from an alphanumeric string (in Excel
2003)when the 7 digit number can appear anywhere in the string and the string
can also contain other numbers which I do not want. I am currently using the
formula
=1*MID(A1,MATCH(TRUE,ISNUMBER(1*MID(A1,ROW($1:$500 ),1)),0),COUNT(1*MID(A1,ROW($1:$500),1)))
which works fine when the alphanumeric string only contains the 7 digit
number I want and no other numbers. However I get errors when the string
includes other numbers.

Is there a formula I could use which would extract the 7 digit number but
which would omit all other groups of, for example, 2 digits or 10 digits?

e.g. in the string "text 1 abc1234567trial10nfy" I would like to extract
1234567.

Many thanks for any help you can give.
snowball