+ Reply to Thread
Results 1 to 12 of 12

Merge rows according to unique IDs in column A- with multiple columns

  1. #1
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Question Merge rows according to unique IDs in column A- with multiple columns

    Hi!
    I have a giant (27K rows) worksheet I need to combine rows for.
    I have data with duplicate IDs in column A and some data in columns B-S. I need to reduce all the duplicate IDs into a single row for each ID while merging the values in columns B-S into a single cell delimited by a comma. It would be a bonus if I could choose the delimiting character.
    It would also be a BIG bonus to be able to delete duplicates.

    I found a very similar function in Jerry Beaucaire's awesome "Excel Assistant" - https://sites.google.com/a/madrocket...ons/merge-rows
    but it will only work for 2 columns, and I have 18.

    Does anyone have a VB function that would work in my case? Or knows of one?
    I cannot change the code myself as I have not programmed in years, and never in VB...

    Thank you so much, and have a lovely weekend!

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge rows according to unique IDs in column A- with multiple columns

    Please down load a sample book. Go in to advance, them attachment

  3. #3
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Merge rows according to unique IDs in column A- with multiple columns

    I created a demo file (can't upload the real one since it has confidential patient information). So it's much smaller, but will convey the idea.

    You can see that I have different values in columns M,N,Q,R. In other columns the data will always be the same for each patient.

    Thank you in advance,
    Inbar
    Attached Files Attached Files

  4. #4
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge rows according to unique IDs in column A- with multiple columns

    I assume you have windows, not mac.

  5. #5
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Merge rows according to unique IDs in column A- with multiple columns

    True. Win8.

  6. #6
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Merge rows according to unique IDs in column A- with multiple columns

    True. Win8.

  7. #7
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge rows according to unique IDs in column A- with multiple columns

    I am not sure the output what you had expected. Please see attached.
    Attached Files Attached Files
    Last edited by AB33; 03-22-2013 at 01:18 PM.

  8. #8
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Merge rows according to unique IDs in column A- with multiple columns

    thanks for the quick reply!
    it's not what I hoped for, for two reasons:
    a. duplicates were not removed
    b. all of the columns are now merged into one column

    my desired output is like in the attached file.
    I'm not even sure it CAN be done, but if it is- it will make my life a whole lot easier!

    tnx
    Attached Files Attached Files

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge rows according to unique IDs in column A- with multiple columns

    Inbars,
    No, the code does not copy duplicates as long as they are in column A, but you may be right that that was not you had expected result. I have now added another different code and different outcome. The rows are the same for both codes. The output is the same as the input-Same sheet1.

  10. #10
    Registered User
    Join Date
    03-22-2013
    Location
    Israel
    MS-Off Ver
    Excel 2010
    Posts
    6

    Re: Merge rows according to unique IDs in column A- with multiple columns

    Thanks for the help,
    I was also emailing Jerry Beaucaire (owner of "Excel Assistant" - https://sites.google.com/a/madrocket...xcelassistant/ ) - and he modified his code so it will also work for multiple columns.
    Thanks Jerry!
    (I don't know if it's OK for me to post his new code here, but I'm sure he'll put it on his website for future reference).

    Have a good weekend everyone!

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Merge rows according to unique IDs in column A- with multiple columns

    inbars,
    Please post it here, so that myself and other users and members will benefit.

  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: Merge rows according to unique IDs in column A- with multiple columns

    This should do it. Cell A1 must have the word "ID" in it to confirm the correct sheet is onscreen before it runs. Should work for any length data set.

    Please Login or Register  to view this content.

    If that takes care of your need, select Thread Tools up above and mark this thread as [SOLVED].
    _________________
    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)

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