View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ken Wright Ken Wright is offline
external usenet poster
 
Posts: 634
Default Deleting garbage

Assuming your data is in Col A starting A1, in say D1

=IF(ISERROR(SEARCH("aa???? ",A1)),IF(ISERROR(SEARCH("bb????
",A1)),"",MID(A1,SEARCH("bb???? ",A1),6)),MID(A1,SEARCH("aa???? ",A1),6))

and copy down.

Then copy Col D and paste special as values and then delete Col A.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

----------------------------------------------------------------------------
It's easier to beg forgiveness than ask permission :-)
----------------------------------------------------------------------------

"Sandra" wrote in message
...
I have rows that look like this:

junkjunk junk more junk aa1234 still more junk and even

more
junk
this is also junk aa4567 and so is
this, just junk
junk aabcde junk junk junk junk

And I want to remove all text and spaces except the 6 character string

that
starts with aa.
How can I do that? I've looked at Left and Right and other functions but I
think I'm just too dense.