Highlight duplicate cell only if 2 columns match

excelnewbie726

New Member
Joined
Dec 20, 2021
Messages
3
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
I am trying to figure out how to highlight column A only if column B also is duplicated. The use case is a list of employees and their managers. I only want to highlight cells that the employee and manager match. If the attached snip, I would want cells A2 and A4 highlighted. This seems like a simple problem and I bet it is but I haven't been able to find the solution in the threads I have looked at. Any help is appreciated.

Thank you
 

Attachments

  • Image.png
    Image.png
    3.8 KB · Views: 257

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Welcome to the Board!

You can do this pretty easily with Conditional Formatting.
First, select the cells starting in cell A2 down to the bottom of your data.
Then go to Conditional Formatting, click "New Rule", and choose the "Use a formula to determine which cells to format" option.
Then enter this formula:
Excel Formula:
=countifs(A:A,A2,B:B,B2)>1
Then click the Format button, go to the Fill tab, and choose the yellow color and click OK.
 
Upvote 0
Solution
Hi & welcome to MrExcel.
How about
+Fluff 1.xlsm
AB
1
2Tom PearceBill Brewer
3Tom PearceJan Stewer
4Tom PearcePeter Gurney
5Tom PearceBill Brewer
6Dan'l WhiddonPeter Gurney
7Dan'l WhiddonPeter Davy
8Dan'l WhiddonPeter Davy
9Dan'l WhiddonHarry Hawke
10Dan'l WhiddonTom Cobley
11
12
13
Parts
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A100Expression=COUNTIFS($A$2:$A$100,A2,$B$2:$B$100,B2)>1textNO
 
Upvote 0
Thanks both of these worked. One weird thing I ran into though. If I selected all of column A by click the column A header, it would produce incorrect results. When I clicked and dragged from A1 down, the formula worked as expected. Any idea why the difference?
 
Upvote 0
The first row in the formula must match the first row in the applies to range.
So if you select the entire column, then the A2 & B2 need to be change to A1 & B1
 
Upvote 0
I knew it was something stupid that I was missing. Thank you so much for your help!
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,936
Messages
6,122,340
Members
449,079
Latest member
rocketslinger

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