Find duplicates across sheets

drangle

New Member
Joined
Jan 11, 2017
Messages
13
I have searched Excel Questions and have not found an answer to my question.

I have a spreadsheet with five sheets, I need to see if there are duplicates in column A on three of those sheets. (I am comparing sheet 1 with sheet 2 and sheet 1 with sheet 3.) By the way, column A is social security numbers. This seems simple but I can't seem to highlight column A in two sheets to do conditional formatting.

Thanks for helping.

Dennis
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,055
To clarify, you want to highlight any value in column A of sheets 2 and 3 if the value exists in column A of Sheet1. Is this correct?
 

mumps

Well-known Member
Joined
Apr 11, 2012
Messages
9,055
Try:
Code:
Sub FindDups()
    Application.ScreenUpdating = False
    Dim Rng As Range, RngList As Object, ws As Worksheet
    Set RngList = CreateObject("Scripting.Dictionary")
    With Sheets("Sheet1")
        For Each Rng In .Range("A2", .Range("A" & .Rows.Count).End(xlUp))
            If Not RngList.Exists(Rng.Value) Then
              RngList.Add Rng.Value, Nothing
            End If
        Next
    End With
    For Each ws In Sheets(Array("Sheet2", "Sheet3"))
        For Each Rng In ws.Range("A2", ws.Range("A" & ws.Rows.Count).End(xlUp))
            If RngList.Exists(Rng.Value) Then
              Rng.Interior.ColorIndex = 3
            End If
        Next
    Next ws
    Application.ScreenUpdating = True
End Sub
 

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
41,168
Office Version
365
Platform
Windows
Select A2:a last row on sheet 2 & use this formula
=ISNUMBER(MATCH(A2,Sheet1!$A$2:$A$49,0))
then select your format

Do the same for sheet3
 

Watch MrExcel Video

Forum statistics

Threads
1,099,953
Messages
5,471,678
Members
406,778
Latest member
markusreyes2907

This Week's Hot Topics

Top