parsing a string

B

BorisS

I need to parse a long string (LONG string) into separate cells. Any help?

String is of the format
YYtest dataXXtest data2XXtest data3YYtest data4XXso on

Basically, these are company names and person names associated with those
companies. Each string will start with YY followed by a company name (which
ends at the next XX). There will always be an XX after the string following
YY, as the XX is the first name of a person in that company. Then, there
will either be another XX (meaning the next name in of a person in the
company) or YY (meaning only one person in the first company, and then
listing of the next company).

I need something that will take the entire string, and divide into two
columns the company and name of each entry. So the way I can logically think
through it (although I don't know the code) is as follows:

1) Take first string after YY but before next XX or YY
2) Paste that in activecell, move right
3) take next part of string PRIOR to next XX or YY, and print to right of
just pasted company name (there will always be a name after a company name,
so at least one time after a company name is pasted, there will be a
MoveRightPasteNextName part
4) Take next two letters of string
4a. If XX, this means more than one name from same company.
4a(i). In this case, take the company name that was stored in some CompName
variable (need that in this loop, as you’ll have to reuse company name in
this case), paste in next line, first cell
4a(ii). take next part of string PRIOR to next XX or YY, and print to right
of company name (so this is the second line of the same company, in this case)
4b. If YY, this means there was only one name for that last company, and
therefore you need to now renew the company name variable with the next
string portion’s value. Repeat the logic of pasting the company name, then
checking to see if multiple names from same company, etc.

hoping that makes enough sense to where someone can help me out.

Thx a ton! There is heavy lifting involved in getting the strings (which
don't originally have the YY and XX dividers), as I have to go in and
basically divide up one extended string with these markers. But hopefully if
I get that done and someone can help with the code to parse, I can get this
into a list format.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top