+ Reply to Thread
Results 1 to 11 of 11

Concatenate columns

  1. #1
    Registered User
    Join Date
    11-10-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    7

    Post Concatenate columns

    Hello all,

    I would like to have a code which does a concatenate operation of 1st column with the rest columns which has data and highlight it in a different color.

    Eg:

    Lets say i have data in 5 columns. I would like to have 1st and 2nd column's data concatenated in 6th column, 1st and 3rd concatenation in 7th column, 1st and 4th column data in 8th column and so on till end. All these concatenated data should be highlighted in any color.

    Note: No.of columns may differ each time. So based on it macro need to concat the existing columns.

    Thanks for your help.

    Regards
    Attached Files Attached Files
    Last edited by PMSNAGU; 11-12-2018 at 02:37 AM.

  2. #2
    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: Concatenate columns

    The easiest way to do this is with Power Query also known as Get and Transform. Upload your Table to PQ, identify which columns to concatenate and click on the merge icon. Load and Close back to your workbook. Very quick and very easy. This is available to you in Excel 2016 on the Data Tab.
    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

  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,888

    Re: Concatenate columns

    I'm not sure how this will be achieved in Power Query based on the description given that involves cell highlighting. In fact, I am not really entirely sure what the data is meant to look like! I really think we need to see a workbook before advising any further.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Valued Forum Contributor
    Join Date
    11-28-2015
    Location
    indo
    MS-Off Ver
    2016 64 bitt
    Posts
    1,279

    Re: Concatenate columns

    maybe like this ,example in a1:c1 have any value and variant colorindex ,you can concatenate by different color in col a1:c1
    using udf
    =ConcaT(A1:C1)
    Please Login or Register  to view this content.
    "ThankyouFor Attention * And Your Help!!"

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

    Re: Concatenate columns

    Quote Originally Posted by PMSNAGU View Post
    Note: No.of columns may differ each time. So based on it macro need to concat the existing columns.
    How?
    Row by row?


    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.

  6. #6
    Registered User
    Join Date
    11-10-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    7

    Re: Concatenate columns

    Hello All,

    Thanks for the reply. As per request, I have attached the sample excel of my desired output.

    Pls note that No.of columns may differ each time. So based on it macro need to concat the existing columns.

    Thanks.

  7. #7
    Registered User
    Join Date
    11-10-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    7

    Re: Concatenate columns

    Quote Originally Posted by AliGW View Post
    I'm not sure how this will be achieved in Power Query based on the description given that involves cell highlighting. In fact, I am not really entirely sure what the data is meant to look like! I really think we need to see a workbook before advising any further.
    I have attached the workbook for your reference. Pls advice.

    Note that, the column data changes every time. I have provided 3 columns in the sample, but i may get more than or lesser than 3 columns anytime.

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

    Re: Concatenate columns

    Do you want it like this?
    Please Login or Register  to view this content.

  9. #9
    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: Concatenate columns

    Using Power Query, here is the M Code for the merger

    Please Login or Register  to view this content.
    Last edited by alansidman; 11-12-2018 at 04:53 AM.

  10. #10
    Registered User
    Join Date
    11-10-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    7

    Re: Concatenate columns

    Awesome! Thanks Jindon for your support - it worked.

  11. #11
    Registered User
    Join Date
    11-10-2018
    Location
    India
    MS-Off Ver
    2016
    Posts
    7

    Re: Concatenate columns

    Thanks alansidman

+ 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: 07-28-2016, 01:47 AM
  2. Concatenate 2 columns
    By sirgeo in forum Excel Programming / VBA / Macros
    Replies: 14
    Last Post: 05-04-2011, 03:56 PM
  3. Concatenate two columns
    By skyping in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 09-08-2010, 06:51 AM
  4. Concatenate two columns
    By venkatatcts in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-22-2010, 01:59 AM
  5. How to concatenate columns
    By ajkrishna001 in forum Excel General
    Replies: 2
    Last Post: 09-20-2006, 11:57 PM
  6. Concatenate two columns?
    By uma in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-19-2006, 04:50 AM
  7. Concatenate 3 columns.
    By Jim15 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 01:08 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