+ Reply to Thread
Results 1 to 6 of 6

Combine two Columns

  1. #1
    Registered User
    Join Date
    03-15-2015
    Location
    España
    MS-Off Ver
    2013
    Posts
    80

    Combine two Columns

    Hello there,

    I'm wondering how can I combine these two columns, so that the result is the Course name along with the Grade. The problem is that the amount of grades varies per row, so I'm not sure how to accomplish this.

    course grades
    Inglés 901,902,903,904,1101,1102,1103
    Habilidades Comunicativas 805
    Inglés 601,602,603,604,605,705,706
    Habilidades Comunicativas 701
    Sociales 601,602,603,604,605,701,702
    Democracia 603
    Química 904,1001,1002,1003,1004,1101,1102,1103
    Matemáticas 1001,1002,1003,1004,804
    Geometría 705,706,804
    Estadística
    1001,1002,1003,1004
    Física 1001,1002,1003,1004,1101,1102,1103
    Habilidades Comunicativas 804
    Lengua Castellana 801,802,803,804,805
    Habilidades Comunicativas 801,802


    The expected result is:

    Ingles901,Ingles902,Ingles903,Ingles904,Ingles1101,Ingles1102,Ingles1103
    Sociales601,Sociales602,Sociales603,Sociales604,Sociales605,Sociales701,Sociales702
    Democracia603

    And so on...
    Any advise?
    Thank you.

  2. #2
    Forum Expert Pepe Le Mokko's Avatar
    Join Date
    05-14-2009
    Location
    Belgium
    MS-Off Ver
    O365 v 2402
    Posts
    13,446

    Re: Combine two Columns

    Attach a sample workbook (not a picture or pasted copy). Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

  3. #3
    Registered User
    Join Date
    03-15-2015
    Location
    España
    MS-Off Ver
    2013
    Posts
    80

    Re: Combine two Columns

    Hello,

    Find the file attached.
    Thank you for your time.
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,078

    Re: Combine two Columns

    How about
    Please Login or Register  to view this content.
    Used like
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  5. #5
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Combine two Columns

    This can also be done without VBA using Power Query.

    See attachment.

    Note that this method will combine the values in column B for duplicate names in column A.
    Attached Files Attached Files
    Last edited by 63falcondude; 05-21-2019 at 12:11 PM.

  6. #6
    Forum Expert 63falcondude's Avatar
    Join Date
    08-22-2016
    Location
    USA
    MS-Off Ver
    365
    Posts
    6,266

    Re: Combine two Columns

    Here are the steps that you can take to produce the output from post #5 given your workbook from post #3:

    1) Highlight your data > Data > From Table > OK
    2) Select Column2 > Change Data Type to Text > Replace current
    3) Select Column2 > Transform > Split Column > By Delimiter > Comma > Each occurrence > OK
    4) Select Column1 > Unpivot other columns
    5) Remove attribute column by selecting it then going to Home > Remove Columns
    6) Sort by Column1 then by the Value column by clicking on the drop down to the right of the headers then selecting Ascending
    7) Add Column > Column From Examples > Type Artística601 into the first row > OK
    8) Remove value column
    9) Select Column1 > Group By > Group by: Column 1 > New column name: Result > Operation: All Rows > OK
    10) Add Column > Custom Column > formula: =Table.Column([Result],"Merged") > OK
    11) Click on the button to the right of the Custom column header and select Extract Values > Comma > OK
    12) Remove Result column
    13) Close & Load

    Once you have this set up, all that you have to do going forward is put any new data at the bottom of the table and refresh the green Power Query table.

+ 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. Replies: 3
    Last Post: 03-28-2018, 05:08 PM
  2. [SOLVED] Macro to combine Qty and Price Columns separated by Total Columns
    By prkhan56 in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 08-17-2017, 02:46 AM
  3. Replies: 6
    Last Post: 11-25-2015, 01:01 PM
  4. Macro to combine multiple columns keeping few columns specific
    By lramesh in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-16-2013, 12:44 PM
  5. MAcro to - copy, transpose, text to columns, remove column A, combine all columns in 1
    By galvinpaddy in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 08:48 AM
  6. Replies: 1
    Last Post: 02-13-2012, 08:08 PM
  7. Replies: 0
    Last Post: 07-31-2006, 12:13 PM

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