excel - Searching for variable length, delimited string based on the location of another string -
my first ever post... experienced excel, not string searching/parsing...
i have bunch of fields/cells of following form:
"formid";s:4:"1001";s:11:"mkto_mrm_id";s:6:"287227";s:15:"activity_name_m";s:59:"ca erwin data modeler community edition evaluation software";s:13:"csu_driver__c";s:0:""
the format - label, length of upcoming string, string - so, label 'formid'
length of upcoming field 4 , value '1001'
.
the number of labels , values can vary field field
what want parse data find half dozen label/value pairs out of data , stick values in separate cell in spreadsheet.
there lots of delimiters, think simplest approach - if doable - find label want, return whatever between next set of quotes.
so in above example search "mkto_mrm_id"
return between next 2 quotes - in case "287227"
.
so have half dozen formulas each in column right of data parse data looking each formula looking 1 of half dozen labels i'm interested in proceeding return between next 2 quotes. nothing or variable length string.
hope that's clear.
thanks in advance.
phil
ok, went ahead , solved problem using formulas. example spreadsheet
i placed text on second sheet , calculate index of quotes. ignore of lengths can figure out quotes. here example of part text in a1 (repeated down in column entries have - displaying 3 columns here)
=find("""", a1) =find("""", $a1, b1 + 1) =find("""", $a1, c1 + 1)
then on sheet1, calculate headings on first row (displaying 2 columns here)
=mid(sheet2!$a$1, sheet2!b1 +1,sheet2!c1 - sheet2!b1 - 1) =mid(sheet2!$a$1,sheet2!f1 +1, sheet2!g1 - sheet2!f1 - 1)
then on each row calculate each column value this. (displaying 2 columns here
=mid(sheet2!a1, sheet2!d1 +1, sheet2!e1 - sheet2!d1 - 1) =mid(sheet2!a1, sheet2!h1 +1, sheet2!i1 - sheet2!h1 - 1)
each of these can blocked , dragged down many rows need.
i trying figure out how send copy of sheet....
full spreadsheet text sheet 1 row 1
=mid(sheet2!$a$1, sheet2!b1 +1,sheet2!c1 - sheet2!b1 - 1) =mid(sheet2!$a$1,sheet2!f1 +1, sheet2!g1 - sheet2!f1 - 1) =mid(sheet2!$a$1, sheet2!j1 +1, sheet2!k1 - sheet2!j1 - 1) =mid(sheet2!$a$1, sheet2!n1 +1, sheet2!o1 - sheet2!n1 - 1)
sheet 1 row 2 (box drag 1 down every row of data have
=mid(sheet2!a1, sheet2!d1 +1, sheet2!e1 - sheet2!d1 - 1) =mid(sheet2!a1, sheet2!h1 +1, sheet2!i1 - sheet2!h1 - 1) =mid(sheet2!a1, sheet2!l1 +1, sheet2!m1 - sheet2!l1 - 1) =mid(sheet2!a1, sheet2!p1 +1, sheet2!q1 - sheet2!p1 - 1)
sheet 2 row 1 (box drag 1 down every row have)
"formid";s:4:"1001";s:11:"mkto_mrm_id";s:6:"287227";s:15:"activity_name_m";s:59:"ca erwin data modeler community edition evaluation software";s:13:"csu_driver__c";s:0:"" =find("""", a1) =find("""", $a1, b1 + 1) =find("""", $a1, c1 + 1) =find("""", $a1, d1 + 1) =find("""", $a1, e1 + 1) =find("""", $a1, f1 + 1) =find("""", $a1, g1 + 1) =find("""", $a1, h1 + 1) =find("""", $a1, i1 + 1) =find("""", $a1, j1 + 1) =find("""", $a1, k1 + 1) =find("""", $a1, l1 + 1) =find("""", $a1, m1 + 1) =find("""", $a1, n1 + 1) =find("""", $a1, o1 + 1) =find("""", $a1, p1 + 1)
Comments
Post a Comment