Conditional formatting with two columns

Alotheal

New Member
Joined
Sep 2, 2022
Messages
6
Office Version
  1. 365
Platform
  1. Windows
I want to treat two columns as one and compare rows.
I need to look for duplicates but they are dependent on two columns.. I'll try to give a visual example.

NumberStageDescStateOPDate
123RedHey!.........
123OrangeHey.........
456GreenCats.........
876BlueDogs.........
123RedHey!.........

As you can see Number "123" and Stage "Red" appeared twice so they will be highlighted. Notice there are other similar Numbers and Stages but both don't match simultaneously. So my goal is to make this happen preferably with a conditional formatting formula.
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Use the COUNTIFS formula, counting how many records match both those two fields, and see if it is greater than 1, i.e.
Selecting the range A2:B to the last used row, and using this Conditional Formatting formula:
Excel Formula:
=COUNTIFS($A:$A,$A2,$B:$B,$B2)>1
 
Upvote 0
Solution
Use the COUNTIFS formula, counting how many records match both those two fields, and see if it is greater than 1, i.e.
Selecting the range A2:B to the last used row, and using this Conditional Formatting formula:
Excel Formula:
=COUNTIFS($A:$A,$A2,$B:$B,$B2)>1

Thank you, this works very well.
:)
 
Upvote 0

Forum statistics

Threads
1,224,816
Messages
6,181,141
Members
453,021
Latest member
Justyna P

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