+ Reply to Thread
Results 1 to 7 of 7

split a string of text in one cell into 2 new cells after occurance of second comma

  1. #1
    Registered User
    Join Date
    02-07-2012
    Location
    LA
    MS-Off Ver
    Excel For Mac 2011
    Posts
    99

    split a string of text in one cell into 2 new cells after occurance of second comma

    Hi , I'm trying to separate a string of text (keywords) separated by comas into 2 cells. Trying to put the first 3 words in B2 and the remaining words into C2 (i.e.- separate words into another cell after the second comma occurs). Any help would be much appreciated. Example below

    example:

    A2 = red, blue, green, yellow, orange, purple, gray, tan

    desired result

    B2 =red, blue, green
    C2 =yellow, orange, purple, gray, tan

    thanks

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,039

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    Put this B2...
    =LEFT(A2,FIND("xx",SUBSTITUTE(A2,",","xx",3))-1)

    Then use this in C2...
    =MID(SUBSTITUTE(A2,B2,""),3,99)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    Enter this formula in B2 and pull it to the right

    =TRIM(MID(SUBSTITUTE(SUBSTITUTE("|"&$A2,",","|",3),"|",REPT(" ",125)),125*COLUMNS($A:A),125))

    Row\Col
    A
    B
    C
    2
    red, blue, green, yellow, orange, purple, gray, tan red, blue, green yellow, orange, purple, gray, tan
    If you like my answer please click on * Add Reputation
    Don't forget to mark threads as "Solved" if your problem has been resolved

    "Nothing is so firmly believed as what we least know."
    --Michel de Montaigne

  4. #4
    Registered User
    Join Date
    02-07-2012
    Location
    LA
    MS-Off Ver
    Excel For Mac 2011
    Posts
    99

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    This works amazingly! thanks so much

  5. #5
    Registered User
    Join Date
    02-07-2012
    Location
    LA
    MS-Off Ver
    Excel For Mac 2011
    Posts
    99

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    ..I just tried Alkey's as well. Both work . Thanks to you both!

  6. #6
    Forum Guru AlKey's Avatar
    Join Date
    07-20-2009
    Location
    Lakeland, FL USA
    MS-Off Ver
    Microsoft Office 2010/ Office 365
    Posts
    8,903

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    You're welcome and thank you for the feedback!

  7. #7
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    53,039

    Re: split a string of text in one cell into 2 new cells after occurance of second comma

    Happy to help, thanks for the feedback

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] switch text string with comma separator into separate cells
    By petrasimonova in forum Excel Formulas & Functions
    Replies: 11
    Last Post: 04-17-2013, 07:40 AM
  2. [SOLVED] Split the contents of the cell separated by comma into different cells
    By VivekBhise in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 07-30-2012, 06:50 AM
  3. Please Help - split a string having both comma (,) and semicolon(;)
    By Chandan.jha in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-06-2012, 01:53 AM
  4. Replies: 3
    Last Post: 01-13-2012, 08:20 AM
  5. Split cells and insert new row when cell contains a comma
    By nalfin in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2009, 10:56 AM

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