Comparing two lists and highlighting matches

GodzFire

New Member
Joined
Apr 30, 2018
Messages
20
Hello everyone. I have the following scenario:

I have two tabs. In sheet A col C I have a bunch of computer names. In sheet B col B I have a bunch of computer names. What I would like is to compare the two lists, and if there is a match, that match is highlighted in the first sheet.

How would I go about this? Many thanks in advance!
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
How about
Code:
Sub MatchHighlight()
   Dim Cl As Range
   Dim Ws1 As Worksheet
   Dim Ws2 As Worksheet
   
   Set Ws1 = Sheets("SheetB")
   Set Ws2 = Sheets("SheetA")
   With CreateObject("scripting.dictionary")
      .comparemode = vbTextCompare
      For Each Cl In Ws1.Range("B2", Ws1.Range("B" & Rows.Count).End(xlUp))
         If Not .exists(Cl.Value) Then .Add Cl.Value, Nothing
      Next Cl
      For Each Cl In Ws2.Range("C2", Ws2.Range("C" & Rows.Count).End(xlUp))
         If .exists(Cl.Value) Then Cl.Interior.Color = 45678
      Next Cl
   End With
End Sub
 
Upvote 0
Thanks Fluff that does work, however is there a way to accomplish this as a formula and/or conditional formatting combo? This is a shared document so it's hard to open up and make edits with macros.

EDIT: Another reason is that I have some of the above that are already coloring some cells, and I need this to override or have a higher level/priority than the other ones.
 
Last edited:
Upvote 0
I suspect that it can be done via Cf/Formulae, but I've no idea how.
That's not my forte, I'm afraid.
 
Upvote 0
Trying njimack's method I get the following error:
J5soCNA.jpg
 
Upvote 0
Excel Workbook
A
1Computer 1
2Computer 2
3Computer 3
4Computer 4
5Computer 5
6Computer 6
7Computer 7
8Computer 8
9Computer 9
10Computer 10
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A11. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A21. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A31. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A41. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A51. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A61. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A71. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A81. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A91. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
A101. / Formula is =COUNTIF(Sheet2!$A$1:$A$7,A1)>0Abc
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,824
Messages
6,181,186
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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