+ Reply to Thread
Results 1 to 6 of 6

Macro to merge duplicate rows unique values - current macro not working

  1. #1
    Registered User
    Join Date
    08-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    36

    Macro to merge duplicate rows unique values - current macro not working

    Hello,

    Am trying to find a macro that works to merge duplicate rows unique values. I currently am using the below macro which appears to work on test sheets, it merges the unique values in column B and separates them by a comma and a space (which i need) but it removes column C if there is any data in column C and when used on larger spreadsheets it deletes around 4 random unique values.

    Example sheet
    Macro Example.xlsx

    What i really need is a macro that will do the following:
    - Find all duplicate rows
    - Merge unique values in those duplicate rows and place in column B with each value separated by ", " (comma and a space)
    - Delete all duplicates (only keeping the one with all values in column B)
    - KEEP the following columns of data. column B is the ONLY column that contains unique values in the sheet, the following columns will be the exact same information for every duplicate. the macro i am currently using doesn't delete them or anything, it just mixes them up all over the joint so i get descriptions for things in the wrong place (eg. in example sheet, "banana description" will appear in the "Apple" row)

    This is the current macro I am using:

    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to merge duplicate rows unique values - current macro not working

    aimeecrystalaid,

    Thanks for the workbook.

    With your raw data in worksheet Sheet1, the results will be written to worksheet Sheet2 (per your workbook).

    Please TEST this FIRST in a COPY of your workbook (always make a backup copy before trying new code, you never know what you might lose).

    Please Login or Register  to view this content.
    Before you use the macro with Excel 2007 or newer, save your workbook, Save As, a macro enabled workbook with the file extension .xlsm

    Then run the ReorgData macro.
    Have a great day,
    Stan

    Windows 10, Excel 2007, on a PC.

    If you are satisfied with the solution(s) provided, please mark your thread as Solved by clicking EDIT in your original post, click GO ADVANCED and set the PREFIX box to SOLVED.

  3. #3
    Registered User
    Join Date
    08-21-2013
    Location
    Australia
    MS-Off Ver
    Excel 2013
    Posts
    36

    Re: Macro to merge duplicate rows unique values - current macro not working

    Perfect! thanks heaps

  4. #4
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to merge duplicate rows unique values - current macro not working

    aimeecrystalaid,

    Thanks for the feedback.

    You are very welcome. Glad I could help.

    And, come back anytime.

  5. #5
    Registered User
    Join Date
    11-04-2013
    Location
    Prague, Czech Republic
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Macro to merge duplicate rows unique values - current macro not working

    Hello stanleydgromjr

    I'm new to VBA and been going through your macro for like 5 hours now without beying able to expand its magic into next columns.
    How do I apply it for collumns c, d etc.? I guess its a matter of selecting the right range but wasn't able to do this.

    Can u help me pls?

  6. #6
    Forum Expert
    Join Date
    10-10-2008
    Location
    Northeast Pennsylvania, USA
    MS-Off Ver
    Excel 2007
    Posts
    2,387

    Re: Macro to merge duplicate rows unique values - current macro not working

    Shaalokim,

    I just received your Private Message.

    I would think that you should start your own New Thread, with:
    1. an appropriate/descriptive title
    2. what version of Excel and Windows you are using?
    3a. attach a workbook with the raw data on one worksheet
    3b. and, on another worksheet (manually formatted by you) the results you are looking for

    To attach your workbook, scroll down and click on the Go Advanced button, then scroll down and click on the Manage Attachments button.

    4. Then send me a Private Message with a link to this thread, and, with a link to your New Thread, and, I will have a look.



    Please Login or Register  to view this content.

+ 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. Merge Duplicate Rows unique values into single rows for an infinite amount of columns/rows
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-21-2013, 08:43 PM
  2. Help with macro to merge/clear duplicate values and leave unique
    By Jharris360 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-18-2012, 11:38 AM
  3. Merge duplicate row cells, but combine unique cell values (Macro)
    By jcornale in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-08-2012, 06:40 PM
  4. Macro for VLookup: Combine/Merge Data and Insert/Duplicate Rows
    By choofrfreoer in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-08-2011, 04:10 AM
  5. How to merge duplicate rows of data into one row using macro?
    By s0gra8ful in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 05-18-2010, 04:00 AM

Tags for this Thread

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