+ Reply to Thread
Results 1 to 2 of 2

Parse & extract multiple recurring values from a string

Hybrid View

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    charlotte, nc
    MS-Off Ver
    Excel 2003
    Posts
    1

    Exclamation Parse & extract multiple recurring values from a string

    Hello and thanks in advance.

    I have searched and searched and can't seem to find a simple solution to this problem. All help is appreciated.

    I have a column where each cell contains data that seems to be xml. Each row's cell data looks similar to this:

    <ItemSpecifics><NameValueList><Name><![CDATA[Cost(#.##)*]]></Name><Value><![CDATA[34.34]]></Value><Source>ItemSpecific</Source></NameValueList><NameValueList><Name><![CDATA[List price (#.##)*]]></Name><Value><![CDATA[56.66]]></Value><Source>ItemSpecific</Source></NameValueList><NameValueList><Name><![CDATA[Package quantity (#)]]></Name><Value><![CDATA[2]]></Value><Source>ItemSpecific</Source></NameValueList><NameValueList><Name><![CDATA[Promoted to front page (1|0)*]]></Name><Value><![CDATA[1]]></Value><Source>ItemSpecific</Source></NameValueList><NameValueList><Name><![CDATA[Comments (Disabled|Read/Write|Read)]]></Name><Value><![CDATA[Disabled]]></Value><Source>ItemSpecific</Source></NameValueList></ItemSpecifics>
    What I want to do for each cell in each row of this column is find and extract the unknown string variable between each instance of:

    <Name><![CDATA[
    and

    ]]></Name>
    and make make that a header name for a new column IF that column does not yet exist.

    Then I want to find and extract the unknown variable string between:

    <Value><![
    and

    ]]></Value>
    and place it under the header column in the same row as this cell's data.

    So in this example the first header would be:

    Cost(#.##)*
    and the first value under that header would be:

    34.34
    Essentially I'm having a problem learning how to parse xml data in multiple cells and place it in their own columns and rows

    Note: In my spreadsheet the first row already contains header names.

    Note: the next row down would contain the same header names but have different values associated with them.

    Note: I have no way of knowing how many header values will exist before I run the script.

    Thankyou.

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259

    Re: Parse & extract multiple recurring values from a string

    Hello AaronLyles,

    Welcome to the Forum!

    When asking for help with parsing questions, it is important to include an example of the data . The more examples you have the better the results. You should also include before and after results along with any comments. If you have a workbook and/or text file you can post, please do so.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1