Closed Thread
Results 1 to 13 of 13

Finding and deleting both duplicate rows

Hybrid View

  1. #1
    Registered User
    Join Date
    08-05-2007
    Posts
    9

    Question Finding and deleting both duplicate rows

    I deal with leads for a sales room and get sent over leads in bulk, I've created a master scrub list that I can attach to the end of a new lead file and sort by number to show which are duplicates.

    When you do the: Data, Filter, Advanced Filter, select Unique Records, it hides the duplicate but what I need is not only for the duplicate to be hidden or gone but the row that it is a duplicate of, i.e. I need BOTH rows to go

    Name-----number
    Dave 555-1212
    Dave 555-1212
    John 536-2343
    Smith 423-2312


    needs to become

    Name-----number
    John 536-2343
    Smith 423-2312

    I would need a formula that figured out that Dave with number 555-1212 was a duplicate and delete BOTH rows, can anyone help?

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526
    Quote Originally Posted by udfxrookie
    I deal with leads for a sales room and get sent over leads in bulk, I've created a master scrub list that I can attach to the end of a new lead file and sort by number to show which are duplicates.

    When you do the: Data, Filter, Advanced Filter, select Unique Records, it hides the duplicate but what I need is not only for the duplicate to be hidden or gone but the row that it is a duplicate of, i.e. I need BOTH rows to go

    Name-----number
    Dave 555-1212
    Dave 555-1212
    John 536-2343
    Smith 423-2312


    needs to become

    Name-----number
    John 536-2343
    Smith 423-2312

    I would need a formula that figured out that Dave with number 555-1212 was a duplicate and delete BOTH rows, can anyone help?
    Well I am offended
    LOL

  3. #3
    Registered User
    Join Date
    08-05-2007
    Posts
    9
    ROFL... sorry Dave =p

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,526
    Quote Originally Posted by udfxrookie
    ROFL... sorry Dave =p
    Do I understand that you want both duplicates to be deleted?
    Just to make sure, because it is a strange request!!

    Usually just the duplicate is deleted not both records

  5. #5
    Registered User
    Join Date
    08-05-2007
    Posts
    9
    Yes, I need both records deleted...

  6. #6
    Registered User
    Join Date
    08-05-2007
    Posts
    9
    Any ideas?

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

    How about

    Sub aaa()
      For i = Cells(Rows.Count, 1).End(xlUp).Row To 2 Step -1
        If Cells(i, 1) = Cells(i - 1, 1) And Cells(i, 2) = Cells(i - 1, 2) Then
          Cells(i, 1).EntireRow.Delete
          Cells(i - 1, 1).EntireRow.Delete
        End If
      Next i
    End Sub

    rylo

  8. #8
    Registered User
    Join Date
    08-05-2007
    Posts
    9
    Where would I add this code to make it work... I'm kinda new at excel and the guy that normal handles this is gone for a week

  9. #9
    Banned User!
    Join Date
    10-14-2006
    Posts
    1,211
    Quote Originally Posted by udfxrookie
    I deal with leads for a sales room and get sent over leads in bulk, I've created a master scrub list that I can attach to the end of a new lead file and sort by number to show which are duplicates.

    When you do the: Data, Filter, Advanced Filter, select Unique Records, it hides the duplicate but what I need is not only for the duplicate to be hidden or gone but the row that it is a duplicate of, i.e. I need BOTH rows to go

    Name-----number
    Dave 555-1212
    Dave 555-1212
    John 536-2343
    Smith 423-2312


    needs to become

    Name-----number
    John 536-2343
    Smith 423-2312

    I would need a formula that figured out that Dave with number 555-1212 was a duplicate and delete BOTH rows, can anyone help?
    Try this:
    colA: holds names
    colB: holds phone numbers

    create a helper column C
    in C2: =SUMPRODUCT(--($A$2:$A$10=A2),--($B$2:$B$10=B2))
    copy down as far as needed

    Auto Filter > custom > is greater than 1
    select row numbers on far left > Edit > Delete Row > remove filter > Delete helper colC

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

    When you are in the sheet, press ALT F11. This will bring up the VBE. Go Insert, Module, paste in the code. Then go back to the spreadsheet, press ALT F8, select the macro name, then run.

    HTH

    rylo

  11. #11
    Registered User
    Join Date
    08-05-2007
    Posts
    9
    You guys are great! It was a killer going through 16k leads deleting it line by line by line

  12. #12
    Registered User
    Join Date
    10-27-2006
    Posts
    5

    Re: Finding and deleting both duplicate rows

    I have a similar issue. However, I only have 1 column where the data point is duplicated. I need to run a script or macro or something that removes BOTH rows of any item that is duplicated.

    Help, please?

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

    Re: Finding and deleting both duplicate rows

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

Closed 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