Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 191
Default parsing a string

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 youll 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 portions 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.


--
Boris
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Parsing a string neverends Excel Programming 2 June 7th 06 05:38 PM
Parsing a string simonc Excel Programming 4 March 27th 06 08:04 AM
Need help parsing a string Daminc[_38_] Excel Programming 4 January 26th 06 11:53 AM
parsing a string Mark[_57_] Excel Programming 4 April 28th 05 04:42 PM
Parsing a String to get Numbers nabukhalaf[_2_] Excel Programming 4 October 6th 04 12:05 AM


All times are GMT +1. The time now is 05:12 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"