+ Reply to Thread
Results 1 to 5 of 5

Splitting cells into multiple columns by specific string

  1. #1
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Question Splitting cells into multiple columns by specific string

    Hi, all.
    I am trying to split/break a lengthy string into multiple cells by columns.
    The specific string in my case is <li> or <LI>.

    The cell contains html code that I want to break up into separate cells and still include the <li> or <LI> at the beginning of the string.

    For example, the cell A1 contains "blah blah blah <li> ha ha ha ha </li><LI> he he he </LI><Li> ho ho ho</Li>"

    I want this divided up into following format.
    A2: "blah blah blah"
    A3: "<li> ha ha ha</li>"
    A4: "<LI> he he he </LI>"
    A5: "<Li> ho ho ho </Li>"

    Also, there is no limit to how many <LI> would be in the cell, so it has to continue searching the whole text in the string.

    Any help would be greatly appreciated.

    Thank you for the help in advance.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Splitting cells into multiple columns by specific string

    KrNpRiDe,

    Welcome to the Excel Forum.

    Please poast your workbook (or a sample) - scroll down and see "Manage Attachments".
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Splitting cells into multiple columns by specific string

    Thank you for your reply. I have attached the excel file as an example.

    Thank you in advance.
    Attached Files Attached Files

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Splitting cells into multiple columns by specific string

    I would suggest posting the expected results also -- ie in your OP you mention splitting A1 into A2,A3 etc whereas in your sample file A2 is another row of data... so I presume you in fact mean to split A1 into B1 onwards based on LI tag ?

    Please Login or Register  to view this content.
    given the requirement for adding LI to the various strings which can exceed 255 chars in length iteration is required (rather than a simple write back of the array and subsequent evaluate to append strings)

  5. #5
    Registered User
    Join Date
    09-16-2009
    Location
    United States
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: Splitting cells into multiple columns by specific string

    Thanks, DonkeyOte.
    Your code worked perfectly.
    Thank you so much.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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