+ Reply to Thread
Results 1 to 4 of 4

Count duplicate rows then delete duplicates

  1. #1
    Registered User
    Join Date
    03-15-2009
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    5

    Count duplicate rows then delete duplicates

    I have two columns of data, and I need to create a third column to count the number of times that same line appears in the document (and then remove all but the first copy of that line).

    my data looks as follows (and it is sorted so all duplicate rows appear directly next to each other):

    Adam1998 | Jan
    Adam1998 | John
    Adam1998 | John
    Adam1998 | Paul
    Adam1998 | Peter
    Adam1998 | Peter
    Adam1998 | Peter
    Adam1999 |John
    Adam1999 | Paul


    I need this to look as follows:
    Adam1998 | Jan | 1
    Adam1998 | John | 2
    Adam1998 | Paul | 1
    Adam1998 | Peter | 3
    Adam1999 |John | 1
    Adam1999 | Paul | 1

    Thank you
    Last edited by rylo; 03-17-2009 at 08:05 PM.

  2. #2
    Forum Expert
    Join Date
    01-15-2007
    Location
    Brisbane, Australia
    MS-Off Ver
    2007
    Posts
    6,591

    Re: Count duplicate rows then delete duplicates

    Hi

    See how this goes.

    Please Login or Register  to view this content.
    rylo

  3. #3
    Registered User
    Join Date
    03-15-2009
    Location
    NY, NY
    MS-Off Ver
    Excel 2007
    Posts
    5

    Re: Count duplicate rows then delete duplicates

    This worked perfectly. Thank you for your help!

    At first I accidentally selected the wrong sheet - which is why the data did not format correctly.
    Last edited by dougf; 03-15-2009 at 10:05 PM. Reason: updated - error

  4. #4
    Registered User
    Join Date
    02-26-2013
    Location
    Florida
    MS-Off Ver
    Excel 2010
    Posts
    1

    Re: Count duplicate rows then delete duplicates

    Thanks for this post. Great to see someone's response from 2009 helping me out today.

    I was able to adapt this code for a dataset with more columns (7) by increasing the array size and range formulas, but now I have a similar situation with a dataset continues 50+ columns of data. Do you know of a way to reproduce this same output WITHOUT having to manually type out the coding for each new column (i.e. "=sumproduct(--($A$2:$A$" & lastrow & "=A2),--($B$2:$B$" & lastrow & "=b2))"?

+ 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