Results 1 to 5 of 5

Thread: Find duplicate rows in Excel

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    6

    Find duplicate rows in Excel

    How do I find(not delete) duplicate rows in an excel spreadsheet(about 3000 rows), bring them adjucent and may be highlight them?

    Before posting, I searched this forum with "duplicate rows".

  2. #2
    Fanatic Member WorkHorse's Avatar
    Join Date
    Jul 2002
    Location
    Where you live.
    Posts
    591
    The AdvancedFilter will find all "unique" items. So, everything else must be a duplicate. If you highlight everything, then unhighlight the unique items, you have highlighted all duplicates.

    VB Code:
    1. Sub MakeDupsYellow()
    2.    
    3.     Dim myRange         As Range
    4.     Dim strColToSort    As String
    5.  
    6.     'Note: first cell in column is considered a heading
    7.     '      and is not included in the filter.
    8.  
    9.     strColToSort = "A"
    10.  
    11.     Application.ScreenUpdating = False
    12.    
    13.     Set myRange = Columns(strColToSort & ":" & strColToSort)
    14.     myRange.Interior.ColorIndex = 36
    15.     myRange.AdvancedFilter Action:=xlFilterInPlace, Unique:=True
    16.     myRange.Interior.ColorIndex = xlNone
    17.     ActiveSheet.ShowAllData
    18.    
    19.     Application.ScreenUpdating = True
    20.  
    21. End Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Oct 2003
    Posts
    6
    Thanks WorkHorse. Works super!

  4. #4
    New Member
    Join Date
    Nov 2010
    Posts
    1

    Re: Find duplicate rows in Excel

    How do I find the duplicate rows (not delete) when both the first and second column together (first name and last name) need to be found.

  5. #5
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: Find duplicate rows in Excel

    you should have started a new thread for your question rather than resurrecting one from nearly 10 years ago

    you can use countif on first column, if > than1 then loop through with vlookup and check matches in second column, i believe, there would even be some formula to do this
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width