Separating text from within string....

  • Thread starter Thread starter i_sydney_man
  • Start date Start date
I

i_sydney_man

Hi all,
My aim is to extract two different strings from one string.
The text is :
=SUMPRODUCT((Category="Sales & Distributions")*(Dept =
"Marketing")*(Apr))
And i need to separate out into the "Sales & Distributions" and
"Marketing", and most likely "Apr" as well. i have tried various combos
of InStr, Mid, left etc. I can get the "S..& D.." but stumped on the
last two.
Any suggestions would be much appreciated.

Cheers...
 
Hi!

Not real robust (specific to the sample you posted)....

To extract "Marketing" (quotes included):

=MID(A1,FIND("~",SUBSTITUTE(A1,"=","~",3))+1,LEN(A1)-LEN(SUBSTITUTE(A1,"""Marketing""","")))

To extract Apr:

=MID(A1,FIND("~",SUBSTITUTE(A1,")*(","~",2))+3,LEN(A1)-LEN(SUBSTITUTE(A1,"Apr","")))

Biff
 
Back
Top