+ Reply to Thread
Results 1 to 15 of 15

Concatenate columns

  1. #1
    Registered User
    Join Date
    10-22-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Arrow Concatenate columns

    Dear forum,

    I'm looking for a easy way to concatenate columns.

    ....A B C
    1 1 4
    2 2 5
    3 3 6
    4
    5
    6

    I want to get the data of A and B into C:
    C: 1 2 3 4 5 6

    I have 123 colums of data which need to be merged into a single one.

    Thanks for any help!
    Last edited by jschiefer; 10-23-2009 at 01:07 PM.

  2. #2
    Registered User
    Join Date
    10-22-2009
    Location
    Denver, CO
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: How to concatenate columns?

    If you're looking to simply link A and B so they appear together in column C, use the following formula in C1.

    =A1&B1

    The & symbol will tie them together.

  3. #3
    Registered User
    Join Date
    10-22-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Concatenate columns

    This gives me:

    C = 14 25 36

    but I want C = 1 2 3 4 5 6.

  4. #4
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Concatenate columns

    Are you looking to concatenate all values within 123 columns into one cell ?

    What are the lengths of the strings in each cell ?

    How many rows in each column ?

    Are there blanks interspersed amongst the data set - if so are they to be included in the output or simply ignored ?

    Post a sample file which reflects your real requirements - ie a more thorough data set, also be sure to display desired output.

    "Dumbing Down" the example from real scenario is unlikely to prove beneficial in this instance...

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

    Re: Concatenate columns

    If I understand what you're trying to do...create a new column that is the consolidation of all the other columns into one column in the next empty column...I would use a macro for this.

    Please Login or Register  to view this content.
    ===========
    How to use the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.
    _________________
    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!)

  6. #6
    Forum Moderator zbor's Avatar
    Join Date
    02-10-2009
    Location
    Croatia
    MS-Off Ver
    365 ProPlus
    Posts
    15,602

    Re: Concatenate columns

    I know that formula =CONCATENATE(A1:A19) don't work but when we compare it with other excel formulas (like =SUM(A1:A19)) I think it would be nice to implement such thing

  7. #7
    Registered User
    Join Date
    10-22-2009
    Location
    Germany
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Concatenate columns

    Quote Originally Posted by JBeaucaire View Post
    If I understand what you're trying to do...create a new column that is the consolidation of all the other columns into one column in the next empty column...I would use a macro for this.

    Please Login or Register  to view this content.
    ===========
    How to use the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.
    Thank you, you saved me!

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

    Re: Concatenate columns

    If that takes care of your need, be sure to EDIT your original post, click Go Advanced and mark the PREFIX box [SOLVED].


    (Also, use the blue "scales" icon in our posts to leave Reputation Feedback, it is appreciated)

  9. #9
    Registered User
    Join Date
    01-26-2009
    Location
    Kansas, USA
    MS-Off Ver
    Excel 2007
    Posts
    51

    Re: Concatenate columns

    I'm a huge fan of the user defined function concrange (concatenate range). I use it all the time. Try it out, you'll love it.

    Here's where you can find it:
    http://www.vbaexpress.com/kb/getarticle.php?kb_id=817

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

    Re: Concatenate columns

    NukedWhale, that function (which I also use frequently) isn't related to this OPs need.

  11. #11
    Registered User
    Join Date
    07-19-2007
    Posts
    8

    Re: Concatenate columns

    Quote Originally Posted by JBeaucaire View Post
    If I understand what you're trying to do...create a new column that is the consolidation of all the other columns into one column in the next empty column...I would use a macro for this.

    Please Login or Register  to view this content.


    JBeaucaire,

    I think this is a module that should work for me, but I've followed your instructions without success. I have no real knowledge of VBS, so don't get too technical with a reply if you choose to reply. (I consulted this forum a few years ago for this same situation, i.e., a need to concatenate multiple columns/rows with the resulting strings displaying in a new column. The results were exactly what I wanted.)
    Was I to edit your code in some way before copying to the module? ('Something "understood" to VBA-cognicent folks, but not so for those like me)?
    I made sure that my "Macro Security" setting was on Medium/Low.
    My worksheet just sits there and doesn't do a thing. My worksheet is 9 columns by 60,000 rows.
    Many thanks for any suggestions you care to throw my way.

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

    Re: Concatenate columns

    ===========
    How to install the macro:

    1. Open up your workbook
    2. Get into VB Editor (Press Alt+F11)
    3. Insert a new module (Insert > Module)
    4. Copy and Paste in your code (given above)
    5. Get out of VBA (Press Alt+Q)
    6. Save your sheet

    The macro is installed and ready to use. Press Alt-F8 and select ConcatColumns from the macro list.

  13. #13
    Registered User
    Join Date
    07-19-2007
    Posts
    8

    Re: Concatenate columns

    Thanks, but as noted above, I did follow the directions for installing the macro and it did install; ConcatColumns is in the macro list. I'll look into worksheet properties to see if I can find anything that might be blocking the command to run the macro. If you think of any likely suspects please send them my way.
    Thanks, again.

    hdmundt

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

    Re: Concatenate columns

    Feel free to attach a sample workbook with the macro installed and not working, I'll take a look.

  15. #15
    Registered User
    Join Date
    06-28-2010
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Concatenate Macro 2 part copy and paste

    Im sorry. First time posting and of course I did it in the wrong place. Please forgive me
    Attached Files Attached Files

+ 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