+ Reply to Thread
Results 1 to 12 of 12

Merge duplicate rows and sum values

  1. #1
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    241

    Merge duplicate rows and sum values

    Looking for a VBA script to merge data in columns A:D if they are duplicates and sum column E. See example.

    Starting point

    Sample 1.png

    Final

    Sample 2.png

    Any help would be appreciated.

    Thanks,

    Met

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    As we do not have any data neither a rules explanation …

  3. #3
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    241

    Re: Merge duplicate rows and sum values

    I apologize. See attached.

    Thanks,
    Met
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Merge duplicate rows and sum values

    How about
    Please Login or Register  to view this content.

  5. #5
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Merge duplicate rows and sum values

    Hi Metrazal,

    See the attached where you can do a Pivot Table and change the "Design" of the table to show what you want. No formulas needed, simply a little changing of Pivot options. See the attached under your answer where I've done a Pivot.

    Pivot Table instead of VBA.xlsx
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  6. #6
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    241

    Re: Merge duplicate rows and sum values

    Ok. In my large/non sample spreadsheet I get the following error:

    Compile error:
    Method or data member not found (First Index in 5th line of script is highlighted)


    In the Sample spreadsheet I get the following error:

    Run-time error 424
    Object required (If Rng Is Nothing Then in eight line is highlighted)

    Thanks,

    Met

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

    Re: Merge duplicate rows and sum values

    Try
    Please Login or Register  to view this content.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Merge duplicate rows and sum values

    Does it work for you in this file
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    241

    Re: Merge duplicate rows and sum values

    I was able to utilize Jindon's script to achieve the desired results. Thanks to everyone for the quick responses.

    Thanks again,

    Met

  10. #10
    Forum Contributor
    Join Date
    02-16-2006
    Posts
    241

    Re: Merge duplicate rows and sum values

    Fluff13:

    Yours works as well. Thanks again for everything.

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

    Re: Merge duplicate rows and sum values

    You are welcome and thanks for the rep.

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Merge duplicate rows and sum values

    Glad to help & thanks for the feedback

+ 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. [SOLVED] Merge Duplicate Rows
    By abhinavbinkar in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-12-2018, 05:50 AM
  2. [SOLVED] Combine rows with duplicate items in one cell and merge values in other cell
    By Niclal in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-18-2014, 07:04 AM
  3. [SOLVED] Macro to merge duplicate rows unique values - current macro not working
    By aimeecrystalaid in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-06-2013, 03:42 PM
  4. 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
  5. [SOLVED] Merge multiple duplicate rows into columns - more than 65536 rows
    By a3des in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 04-05-2013, 09:18 AM
  6. Merge duplicate rows
    By phanibalagam in forum Excel General
    Replies: 1
    Last Post: 07-27-2011, 10:09 PM
  7. Excel 2007 : Merge duplicate rows
    By phanibalagam in forum Excel General
    Replies: 0
    Last Post: 07-27-2011, 05:16 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