View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Mike H Mike H is offline
external usenet poster
 
Posts: 11,501
Default Search text string for ssn and copy to new column

Mary,

This works for your displayed example. It searches for the first "-" in the
string, counts back 3 places and returns 11 characters from that. If there
are other "-" minus signs before your SSN then this doesn't work:-

=MID(A1,SEARCH("-",A1,1)-3,11)

Mike

"mary" wrote:

I have lines of text containing various information. The SSN section appears
at different spots in the string but is always in the same format
xxx-xx-xxxx. Can I use a formula (IF statement?) to search the strings to
find the ssn and copy it into a separate column? The spacing between items,
characters per item and string length always vary. Ex below.

ADAM SMITH B xxx-xx-xxxx 04/2C 06/26/2006 25951
N 5988