+ Reply to Thread
Results 1 to 14 of 14

Splitting a string into a vertical list based on delimiter?

  1. #1
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Splitting a string into a vertical list based on delimiter?

    Is it possible to alternate the text to column function in VBA to match the following needs:

    Say I have a list of text strings. I would like to go through them one at a time, from top to bottom, and copy the content vertically to one column based on a delimiter "@". That is, the macro should take cell1 in column A (text string one consisting of, say, 7 paragraphs delimited by "@") and copy the parts down in column B and so on with the other strings. In this way creating a list of paragraphs in column B.

    sdfas@xgdg@asdgwrt@fasg@ sdfas
    jwelrjb@dfwg@sdfe@asfweg@ xgdg
    dasf@asf@asfgttyh@sdgshery@fsdh@ asdgwrt
    casdgery@sdhgrh@ fasg
    jwelrjb
    dfwg
    sdfe
    asfweg
    dasf
    asf
    asfgttyh
    sdgshery
    fsdh
    casdgery
    sdhgrh

  2. #2
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Splitting a string into a vertical list based on delimiter?

    If you don't mind a macro, select the data in the column and run:
    Please Login or Register  to view this content.
    Copy the Excel VBA code
    Select the workbook in which you want to store the Excel VBA code
    Hold the Alt key, and press the F11 key, to open the Visual Basic Editor
    Choose Insert | Module
    Where the cursor is flashing, choose Edit | Paste

    To run the Excel VBA code:
    Choose Tools | Macro | Macros
    Select a macro in the list, and click the Run button

  3. #3
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Splitting a string into a vertical list based on delimiter?

    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  4. #4
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    It has a problem with this line
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    Worked like a charm....

  6. #6
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,525

    Re: Splitting a string into a vertical list based on delimiter?

    Hi there,

    Try this - just change the 3 commented lines 'Change to suit' if necessary:

    Please Login or Register  to view this content.
    Regards,

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  7. #7
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    Quote Originally Posted by patel45 View Post
    Please Login or Register  to view this content.

    Is it possible to alter this code in such a way, that it sorts column B and remove doubles on each step ?? If there are more words than the max nb of row in Excel, but of course unique ones...

  8. #8
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Splitting a string into a vertical list based on delimiter?

    Please Login or Register  to view this content.
    Last edited by patel45; 11-19-2012 at 09:39 AM.

  9. #9
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Splitting a string into a vertical list based on delimiter?

    Different method
    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    Quote Originally Posted by patel45 View Post
    Please Login or Register  to view this content.
    This one breaks at "stop"??

  11. #11
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    Quote Originally Posted by jindon View Post
    Different method
    Please Login or Register  to view this content.

    This one breaks at txt = Join$(Evaluate("transpose(" & .Address & ")"))

  12. #12
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    There are 14000 rows in my database
    Last edited by Flabbergaster; 11-19-2012 at 07:56 AM. Reason: spelling

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: Splitting a string into a vertical list based on delimiter?

    Try this one then
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    10-28-2010
    Location
    Denmark, Europe
    MS-Off Ver
    Excel 2010
    Posts
    62

    Re: Splitting a string into a vertical list based on delimiter?

    Perfect!!!!!, thanx

+ 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