+ Reply to Thread
Results 1 to 6 of 6

Values separated by Commas - want in separate columns, cells from original cell

  1. #1
    Registered User
    Join Date
    01-05-2012
    Location
    Salinas
    MS-Off Ver
    Excel 2007
    Posts
    22

    Values separated by Commas - want in separate columns, cells from original cell

    I have a cell that can have any number of values separated by commas. For example:

    1) EG,GH,JK
    2) EG,GH,JK,l,o,2,3,4

    All of these are in one column, but each cell in the column could have any number of combinations.. what I want to do is separate the data by the comma delimitted so the each value goes into a separate column to the right of the original column (or it could start from the original column itself).

    For example in 1) and 2) above:

    1) If Cell(1,1).Value = "EG,GH,JK", the macro would move data to Cell(1,1).Value = "EG", Cell(1,2).Value = "GH", Cell(1,3).Value = "JK"
    2) If Cell(2,1).Value = "EG,GH,JK,l,o,2,3,4' the macro would move data to Cell(2,1).Value = "EG", Cell(1,2).Value = "GH", Cell(1,3).Value = "JK"

    Cell(1,4).Value = "l", Cell(1,5).Value = "o", Cell(1,6).Value = "2", Cell(1,7).Value = "3", and Cell(1,8).Value = "4"

    Greatly appreciate your thoughts on this! Thank you!!

  2. #2
    Valued Forum Contributor
    Join Date
    05-08-2012
    Location
    Georgia, USA
    MS-Off Ver
    Excel 2003, 2010
    Posts
    811

    Re: Values separated by Commas - want in separate columns, cells from original cell

    How about Text to Columns?
    Click on star (*) below if this helps

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Values separated by Commas - want in separate columns, cells from original cell

    You don't need a macro to do this. On your data tab of the ribbon, select Text to columns and follow the wizard instructions. This is a built in Excel functionality
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Registered User
    Join Date
    01-05-2012
    Location
    Salinas
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Values separated by Commas - want in separate columns, cells from original cell

    I think this can be done with Text to Columns, but the array is variable depending upon how many values are separated by commas.

  5. #5
    Registered User
    Join Date
    01-05-2012
    Location
    Salinas
    MS-Off Ver
    Excel 2007
    Posts
    22

    Re: Values separated by Commas - want in separate columns, cells from original cell

    I got it... I removed the field info and works fine. Thanks for your thoughts!

  6. #6
    Forum Expert JBeaucaire's Avatar
    Join Date
    03-21-2004
    Location
    Bakersfield, CA
    MS-Off Ver
    2010, 2016, Office 365
    Posts
    33,492

    Re: Values separated by Commas - want in separate columns, cells from original cell

    if that takes care of your need, please select Thread Tools from the menu above and mark the thread as solved. Thanks.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    ?None of us is as good as all of us? - Ray Kroc
    ?Actually, I *am* a rocket scientist.? - JB (little ones count!)

+ 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