Closed Thread
Results 1 to 5 of 5

Identifying Duplicate Rows within a Range

  1. #1
    nachiks
    Guest

    Identifying Duplicate Rows within a Range

    I get a series of numbers and some gets repeated.And I want to identify them by coloring the cell.

  2. #2
    Forum Contributor
    Join Date
    12-07-2004
    Posts
    596

    Identifying Duplicate Rows within a Range

    Problem:

    The range A2:C6 contains a list of items with their matching categories and prices.
    Any rows containing identical entries are duplicate records.
    We want to identify each duplicate record in the range.
    Solution:

    Use the SUMPRODUCT function as shown in the following formula:
    =SUMPRODUCT((B2=$B$2:$B$6)*(A2=$A$2:$A$6)*(C2=$C$2:$C$6))>1

  3. #3
    Registered User
    Join Date
    12-14-2006
    Posts
    4

    VBA Code may be useful


    The macro I am using for marking duplicates in a range is:


    Sub Mark_Duplicate_Rows()
    'WARNING: PLEASE SORT & SELECT YOUR RANGE BEFORE EXECUTING THIS MACRO
    If MsgBox("Have you sorted & selected your range?", vbYesNo) = vbNo Then Exit Sub
    Application.ScreenUpdating = False
    R1 = Selection.Cells(1).Row
    K1 = Selection.Cells(1).Column
    RL = Selection.Cells(Selection.Cells.Count).Row
    KL = Selection.Cells(Selection.Cells.Count).Column
    CC = Selection.Columns.Count
    If R1 = RL Then
    MsgBox "Select atleast two rows!"
    Exit Sub
    End If
    RDupe = 0
    For j = R1 To RL
    Duplicate = 0
    For i = K1 To KL
    If j > R1 Then
    If Cells(j, i).Value = Cells(j - 1, i).Value Then
    Duplicate = Duplicate + 1
    End If
    End If
    Next
    If Duplicate = CC Then
    Range(Cells(j, K1), Cells(j, K1 + CC - 1)).Select
    Selection.Font.ColorIndex = 3
    Range(Cells(j - 1, K1), Cells(j - 1, K1 + CC - 1)).Select
    Selection.Font.ColorIndex = 3
    RDupe = RDupe + 1
    End If
    Next
    Application.ScreenUpdating = True
    Range(Cells(R1, K1), Cells(RL, KL)).Select
    'If RDupe > 0 Then MsgBox Trim(Str(RDupe)) & " Rows!"
    End Sub

    From:
    Jumbo S.Subramanian from Salem, India

  4. #4
    Registered User
    Join Date
    04-16-2007
    Posts
    2

    How to Merge duplicates

    This is great, how do I merge the duplicates instead?

  5. #5
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    crisjr,

    Please start your own thread and attach a link to this one.

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

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