Conditional Formatting Based on Two Columns for duplicates

dancer5

New Member
Joined
Jan 6, 2023
Messages
12
Office Version
  1. 365
Platform
  1. Windows
I'm running into errors with my conditional formatting. It's highlighting as a duplicate when it's actually not, but it's doing it inconsistently.

I'm looking to highlight the cells in column C and D when there is a duplicate across both columns.

Here's what I have as my conditional formatting formula:
Excel Formula:
=COUNTIFS($C$2:$C$1000,$C2,$D$2:$D$1000,$D2)>1

Conditional Duplicates.xlsx
ABCDE
1DoneQuarterID#Date
2YesQ123-235007111-May-22
3YesQ223-230030116-Sep-22
4YesQ123-230029123-Feb-22
5YesQ211-110034128-Mar-22
6NoN/A29-290007114-Apr-22
7YesQ229-290007231-May-22
8YesQ129-29002311-Jun-22
9YesQ223-235012111-May-22
10YesQ229-29001628-Jun-22
11NoN/A11-110014114-Jun-22
12YesQ111-110014214-Jun-22
13NoN/A11-110014314-Jun-22
14YesQ220-20000617-Jul-22
15YesQ129-290037111-Jul-22
16YesQ288-015005110-Aug-22
17YesQ288-010069111-Aug-22
18YesQ320-200007111-Aug-22
19NoN/A19-195004117-Aug-22
20NoN/A19-195002217-Aug-22
21YesQ311-110057117-Aug-22
22YesQ223-230049117-Aug-22
23YesQ288-010155118-Aug-22
24NoN/A88-010092118-Aug-22
25PEQ320-205028125-Aug-22
26NoN/A20-200017131-Aug-22
27YesQ188-010125117-Nov-22
28YesQ223-230030116-Sep-22
29YesQ229-290035122-Sep-22
30Q429-29003523-Mar-23
31NoN/A11-110059127-Sep-22
32YesQ211-110059227-Sep-22
33NoN/A11-110059128-Sep-22
34NoN/A29-29004515-Oct-22
35YesQ229-29004525-Oct-22
36NoN/A29-29004535-Oct-22
37NoN/A29-29004545-Oct-22
38NoN/A88-010124117-Nov-22
39NoN/A20-205012112-Oct-22
40YesQ220-205012212-Oct-22
41NoN/A20-205012312-Oct-22
42YesQ188-015015119-Oct-22
43YesQ117-170016119-Oct-22
44YesQ188-015004116-Aug-22
45NoN/A20-205001128-Oct-22
46NoN/A17-17000511-Nov-22
47YesQ217-17000527-Dec-22
48YesQ217-17001019-Nov-22
49YesQ211-11501724-Nov-22
50YesQ211-115020115-Nov-22
51YesQ288-015029121-Nov-22
52NoN/A88-015029221-Nov-22
53NoN/A88-015029321-Nov-22
54YesQ129-290056116-Dec-22
55YesQ288-015028121-Nov-22
56YesQ288-010133121-Nov-22
57NoN/A88-010133221-Nov-22
58NoN/A88-015030122-Nov-22
59NoN/A88-015030222-Nov-22
60NoN/A88-015030322-Nov-22
61NoN/A88-015030422-Nov-22
62NoN/A88-015030522-Nov-22
63NoN/A88-015030622-Nov-22
64YesQ288-010135122-Nov-22
65YesQ288-010156129-Nov-22
66NoN/A88-010156229-Nov-22
6788-010156317-Feb-23
68YesQ388-01014715-Dec-22
69NoN/A88-015027123-Nov-22
70YesQ229-295007116-Dec-22
71YesQ217-17500218-Dec-22
72NoN/A17-17500228-Dec-22
73YesQ217-175003214-Dec-22
74YesQ217-175023115-Dec-22
75YesQ121-21502717-Feb-23
76YesQ111-110027127-Feb-23
7711-110027227-Feb-23
7817-17501017-Feb-23
7917-17501027-Feb-23
8011-110055116-Feb-23
8111-115038117-Feb-23
8211-115038217-Feb-23
8317-170008123-Feb-23
8411-110032127-Feb-23
8511-110032227-Feb-23
8617-17003111-Mar-23
8729-29006819-Mar-23
Sheet2
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C1:D1,C74:D74Expression=COUNTIFS($C$2:$C$886,#REF!,$D$2:$D$886,#REF!)>1textNO
C2:D73,C75:D87Expression=COUNTIFS($C$2:$C$886,$C3,$D$2:$D$886,$D3)>1textNO
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
I think your formula is off one column.

You have the following formula being applied starting in row 2:
Rich (BB code):
=COUNTIFS($C$2:$C$886,$C3,$D$2:$D$886,$D3)>1
I think you may need to change it to this:
Rich (BB code):
=COUNTIFS($C$2:$C$886,$C2,$D$2:$D$886,$D2)>1
since you are starting on row 2 (your formula needs to reflect the first row you are starting on).
 
Upvote 0
Solution
Thanks. That seems to have worked. I don't know how it got changed as I inputted C2 and D2. The range was initially C:D as well.
 
Upvote 0
You are welcome. Glad I was able to help!

When Conditional Formatting seems to be a little "off", that is often the issue (formula and range don't line up perfectly).
So that is always a good thing to check/confirm.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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