View Single Post
  #6   Report Post  
Posted to microsoft.public.excel,microsoft.public.excel.misc,microsoft.public.excel.programming
PCLIVE PCLIVE is offline
external usenet poster
 
Posts: 168
Default Need to do a fancy string copy plus

As long as all your data will be in one of those formats, (either 2 strings
with <, 1 string with 1 < 1 without, or 1 string with <), here's one
crazy formula that seems to work.

=IF(LEN(A1)-LEN(SUBSTITUTE(A1,"<",""))=2,LEFT(A1,FIND("",A1)) &"<write:"&SUBSTITUTE(LEFT(SUBSTITUTE(LEFT(A1,FIND ("",A1)),"",")"),FIND("",A1)),"<","(")&""&RIGH T(A1,FIND("",A1,FIND("",A1)+1)-FIND("",A1))&"<write:"&SUBSTITUTE(SUBSTITUTE(RIGH T(A1,FIND("",A1,FIND("",A1)+1)-FIND("",A1)),"<","("),"",")")&"",IF(LEN(A1)-LEN(SUBSTITUTE(A1,"<",""))=1,IF(LEN(A1)FIND("",A 1),LEFT(A1,FIND("",A1))&"<write:"&SUBSTITUTE(SUBS TITUTE(LEFT(A1,FIND("",A1)),"<","("),"",")")&"" &RIGHT(A1,LEN(A1)-8)&"<write:"&RIGHT(A1,LEN(A1)-8)&"",LEFT(A1,FIND("",A1))&"<write:"&SUBSTITUTE( LEFT(SUBSTITUTE(LEFT(A1,FIND("",A1)),"",")"),FIN D("",A1)),"<","(")&"")))

This one was fun.
Paul


"Sally" wrote in message
...
PLEASE save me 8,000 hours of manual work. I know one of you can figure
this
out - I sure can't. Thanks for looking.
I don't know vba at all so if you want me to use it please be specific
about
what to type where.

I have a million rows with data in column A that looks like this
(including
the brackets):

<aaaaaa<bbbbbb
<cccccc111111111111
<ddddddddddddd

And I need column be to copy with additional text like this
<aaaaaa<write:(aaaaaa)<bbbbbb<write:(bbbbbb)
<cccccc<write:(cccccc)111111111111<write:1111111 11111
<ddddddddddddd<write:(ddddddddddddd)

Basically, for every string surrounded by <,
put the following in column B
copy the string surrounded by < but change the < to ()
add "<write:" in front of the string that starts with (
put a after the )

for any strings in column A with no < around it
copy the string and
add "write:" in front of it
put a after it

There can be more than on string with or without < in column A
If there is, everything in Column A needs to be in column B following the
rules above.