Find duplicate entries and highlight in color

sutharsan

New Member
Joined
Sep 12, 2012
Messages
2
Hi

I have two worksheets with names. I want the dublicate name cell to be high lighted. e.g cell in Sheet1 A1 & Sheet2 B1 to be highlighted.

SHEET 1
A1 GillB1 Phillip
A2 ErikB2 Ricky
A3 JackB3 Jason
A4 MieckyB4 Billy

<tbody>
</tbody>



SHEET 2
A1 JohnB1 Gill
A2 PeterB2 Morgan
A3 JonesB3 Howard
A4 ThompsonB4 Smith
A5 JardineB5 Kivell

<tbody>
</tbody>
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
you will need to name your range say sheet 1 A1:B5 = names
sheet 2 A1:B5 = mynames
highlight sheet 1 A1:B5 and go conditional format / formula is =isnumber(match($A1,mynames,0)) and format your colour
highlight sheet 2 A1:B5 and go conditional format / formula is =isnumber(match($A1,names,0)) and format your colour
 
Upvote 0
you will need to name your range say sheet 1 A1:B5 = names
sheet 2 A1:B5 = mynames
highlight sheet 1 A1:B5 and go conditional format / formula is =isnumber(match($A1,mynames,0)) and format your colour
highlight sheet 2 A1:B5 and go conditional format / formula is =isnumber(match($A1,names,0)) and format your colour

Following grizz idea of naming ranges (names and mynames) but changing the formulas to

=COUNTIF(mynames,A1)>0
and
=COUNTIF(names,A1)>0

Note: the MATCH function works only with one-dimensional ranges

M.
 
Upvote 0
Hi

I have two worksheets with names. I want the dublicate name cell to be high lighted. e.g cell in Sheet1 A1 & Sheet2 B1 to be highlighted.

...
try a macro?
Code:
Sub highlight_dups()

Dim d1 As Object, d2 As Object, c As Range

Set d1 = CreateObject("scripting.dictionary")
Set d2 = CreateObject("scripting.dictionary")
d1.comparemode = 1: d2.comparemode = 1

For Each c In Sheets(1).UsedRange
    d1(c.Value) = 1
Next

For Each c In Sheets(2).UsedRange
    If d1(c.Value) = 1 Then c.Font.Color = vbRed
    d2(c.Value) = 1
Next

For Each c In Sheets(1).UsedRange
    If d2(c.Value) = 1 Then c.Font.Color = vbRed
Next

End Sub
 
Upvote 0

Forum statistics

Threads
1,220,965
Messages
6,157,119
Members
451,399
Latest member
alchavar

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top