+ Reply to Thread
Results 1 to 8 of 8

Combining several duplicate rows, summing one column, and removing original duplicates

  1. #1
    Registered User
    Join Date
    10-12-2012
    Location
    Portland
    MS-Off Ver
    Excel 2003
    Posts
    8

    Combining several duplicate rows, summing one column, and removing original duplicates

    Hi. There are several threads on this forum with similar keywords (e.g., this one) but they do not have exactly what I need.

    I am looking to simply de-dupe the rows that are repeated -- duplicates being recognized based on two columns and then if the rows are duplicate, folding them into one row but with "Qty" column being incremented.

    Attached is a simple example. In this file:

    1. Duplicates are recognized by two columns: Title (C) + Images (E). Currently there may be duplicate rows with exactly the same value across these two columns, each row having Quantity (column M) as 1.

    2. I want to merge these separate rows into unique rows, and correspondingly increment the Qty column based on how many original duplicate rows existed.

    3. These de-duped rows should be in a new worksheet.

    Just FYI, I am on Excel on Mac 2011 -- latest version 14.2.3, which can run exactly the same macros and VB functions as Windows. Would appreciate any pointers or function writing help.

    Thanks!
    Attached Files Attached Files
    Last edited by pkiula; 10-12-2012 at 08:55 PM.

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    Try this formula method,

    In Desired sheet!C2,

    =IFERROR(INDEX(Current!C$2:C$17,MATCH(TRUE,INDEX(ISNA(MATCH(Current!C$2:C$17,C$1:C1,0)),0),0)),"")

    then copy down.

    In A2,

    =IF($C2="","",INDEX(Current!A:A,MATCH($C2,Current!$C:$C,0)))

    then copy down & across in other columns.

    In M2, Qty olumn,

    =IF($C2="","",COUNTIF(Current!C:C,C2))

    then copy down.
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    10-12-2012
    Location
    Portland
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    Thanks Haseeb. This works for my sample file, so I guess the direction is right, but on my actual file this doesn't work. Leaves hundreds of blank rows. And in some columns, where there were many empty values for a row, it stops copying the formula "down" below the last empty row.

    I could share my original file, but that is a bit confidential to post on a public forum. What should I do? Can I send you the file by email or something?

    This is what the file looks like: http://i.imgur.com/0Y0Ma.png - see empty rows by the hundreds below a certain point.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    How you are getting data pkiula? Importing from a Database, website or from some where else?
    Is there any blank rows in original sheet (Current)?

  5. #5
    Registered User
    Join Date
    10-12-2012
    Location
    Portland
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    The original Excel is a static file. No empty rows at all. No importing of data from anywhere. The "Current" worksheet has everything. About 3,000 rows.

  6. #6
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    If actual data doesn't have any blank rows, a quick question..

    =IFERROR(INDEX(Current!C$2:C$17,MATCH(TRUE,INDEX(ISNA(MATCH(Current!C$2:C$17,C$1:C1,0)),0),0)),"")

    Did you adjust the ranges in the red highlighted part? If you have 3000 rows, it should be like C$2:C$3002

  7. #7
    Registered User
    Join Date
    10-12-2012
    Location
    Portland
    MS-Off Ver
    Excel 2003
    Posts
    8

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    Oh, no I just blindly copied your formula My bad. Is there any way to specify "CurrentSheet.End" or something, instead of using numbers like that?

  8. #8
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    365
    Posts
    2,243

    Re: Combining several duplicate rows, summing one column, and removing original duplicates

    You can use Dynamic named range, here is a link,

    http://blog.contextures.com/archives...dynamic-range/

    You can Google it for more

+ 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