+ Reply to Thread
Results 1 to 6 of 6

Consolidate rows with duplicate ID number into one row

  1. #1
    Registered User
    Join Date
    09-15-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Consolidate rows with duplicate ID number into one row

    Hi everyone. I had a question that's been bugging me for a bit. If there are duplicates of an ID number in my database, how do I consolidate these into a single row and delete the duplicate? This is best illustrated in the example attached. What I have is on sheet one, what I need is on sheet 2. Thanks!
    Attached Files Attached Files

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

    Re: Consolidate rows with duplicate ID number into one row

    This would normally require VBA to accomplish. Macros.

    If that's ok, then:

    Here's a macro for merging columns of data to one row matching for column A. There's a sample workbook too you could drop your data into and test it out.The macro is called Consolidate and it's pretty much ready to work as is. When you copy the macro into your workbook, you can remove the section entitled 'add titles'... up to you.

    ===================

    How/Where 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 - be sure to edit out the "add titles" section, else you'll have to clean the headers up, no big deal)
    5. Get out of VBA (Press Alt+Q)
    6. Save as a macro-enabled workbook (.xlsm)

    The macro is installed and ready to use. Press Alt-F8 and select it from the macro list.
    Last edited by JBeaucaire; 12-27-2019 at 10:44 PM.
    _________________
    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!)

  3. #3
    Registered User
    Join Date
    09-15-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Consolidate rows with duplicate ID number into one row

    Thanks JBeaucaire! There is still 1 problem I can't seem to fix. I used your consolidate (part2) macro, however, many of the cells in my spreadsheet are blank. It seems that if the 1st cell in a row is blank (not the ID number) then the macro will only move data from the next cell in that row and onward up into the same row. This could probably be solved easily if I knew how to find and replace missing values with a "." or something of the sort. Any ideas? Thanks again!

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

    Re: Consolidate rows with duplicate ID number into one row

    I have no ideas other than the example data set you provided, the macro suggested works for that format.

    You have a better example I would certainly take a look. Better, upload an actual workbook with BEFORE/AFTER sheets that represents ALL the variations that have to be dealt with.

  5. #5
    Registered User
    Join Date
    09-15-2009
    Location
    Los Angeles, CA
    MS-Off Ver
    Excel 2007
    Posts
    17

    Re: Consolidate rows with duplicate ID number into one row

    Never mind figured it out. Thanks again.

  6. #6
    Forum Expert Cutter's Avatar
    Join Date
    05-24-2004
    Location
    Ontario,Canada
    MS-Off Ver
    Excel 2010
    Posts
    6,451

    Re: Consolidate rows with duplicate ID number into one row

    @ BME_Guy

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. I'll do that for you now but please keep in mind for your future threads that Rule #9 requires you to do that yourself. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as an infrequent user of the forum, you may have forgotten (or may not be aware) that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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