conditional formatting duplicate values two conditions

mohamed ali abdelgawad

Board Regular
Joined
Nov 18, 2016
Messages
71
Office Version
  1. 365
Platform
  1. Windows
Hi Dears
need your help here please

i have 3 columns

in column A i enter ( In or Out )
in column B and C i enter numbers

what i want to do to highlight duplicated value only if thecell A value = IN
two conditions ( duplicated and cell A = IN )
attached sheet will help you to understand what i want exactly

Download

hope my weak English help me to delevere what i want :)
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
Hi, Mohamed!

I use helper columns (H and I) to list numbers when column A is "IN" only. Those helper columns can be hidden.
Formula below in H2, copy to I2, then copy down:

Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64"]=IF($A2="IN",B2,"")[/TD]
[/TR]
</tbody>[/TABLE]


Next, select your data range for highlighting.
In conditional formatting, select New Rule,
Then select "Use a Formula to determine cells to format",
Paste formula below in "Format Values in which this formula is true"
Select format pattern as desired, click OK.

Code:
[TABLE="width: 64"]
<tbody>[TR]
  [TD="width: 64"]=AND($A2="IN",OR(COUNTIF($H$2:$I$100,H2)>1,COUNTIF($H$2:$I$100,I2)>1))[/TD]
[/TR]
</tbody>[/TABLE]

Adjust range in formula to fit.

Good luck!
 
Upvote 0
Hello, Mohamed. Here is another solution. You will need to apply TWO conditional formatting rules:

Select the range from B2 down. Apply the following custom CF rule and format the fill as desired:

Code:
=AND(UPPER(A2)="IN",SUMPRODUCT((UPPER(A:A)="IN")*((B:B=B2)+(C:C=B2)))>1)

Select the range from C2 down. Apply the following custom CF rule and format the fill as desired:

Code:
=AND(UPPER(A2)="IN",SUMPRODUCT((UPPER(A:A)="IN")*((B:B=C2)+(C:C=C2)))>1)
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,179
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