View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default Extracting numbers from alphanumeric strings

On Fri, 4 Apr 2008 14:41:00 -0700, Poonam
wrote:

SSHRC856-2004-0033 Bielawski
SSHRC858-20-0027Nadasdi
SSHRC858-04-0001Daveluy
SSHRC856-04-010 Blair,H
SSHRC421-2005-03 Haggerty
SSHRC861-2005-025 Garvin

For e.g from above information is in Cell A, I want to have only no. like
from ISt 856-2004-0033, Could it possible by signle line formula.

Thanks in advance

Poonam


This will return all the numbers and hyphens beginning with the first digit and
ending with the first character that is not a digit or hyphen:

=TRIM(MID(A1,MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&" 0123456789")),MIN(SEARCH(
{"a","b","c","d","e","f","g","h","i","j","k","l"," m","n","o","p","q","r","s","t","u","v","w","x","y" ,"z"},
A1&"abcdefghijklmnopqrstuvwxyz",MIN(SEARCH({0,1,2, 3,4,5,6,7,8,9},
A1&"0123456789"))))-MIN(SEARCH({0,1,2,3,4,5,6,7,8,9},A1&"0123456789")) ))

--ron