Flag only if there are duplicate values and matching criteria in another column

Dokat

Active Member
Joined
Jan 19, 2015
Messages
304
Office Version
  1. 365
Hi

I am trying the flag "Ration" in the output column based on 2 criteria,

1 Only duplicate values in CCP Name.

2. Corresponding Stock Type for duplicate values has to be 'Inactive - Use Up Inventory" . In below ex. i put the ration where there is duplicate values in CCP Name column and Stock type for both duplicate values is "Inactive-Use Up Inventory". Does anyone had a similar issue and formula that can solve it?

CCP NameStock TypeOutput
CSA11-BLK​
Active - Use Up Inventory
CSA11-BLU​
Inactive - Use Up Inventory
Ration​
CSAP51-BLK​
Inactive - Use Up Inventory
CSAP51-BLU​
Inactive - Use Up Inventory
CSAP51CS-BLK​
Inactive - Use Up Inventory
CSA11-BLU​
Inactive - Use Up Inventory
Ration​
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Like this?

20 11 20.xlsm
ABC
1CCP NameStock TypeOutput
2CSA11-BLKActive - Use Up Inventory 
3CSA11-BLUInactive - Use Up InventoryRation
4CSAP51-BLKInactive - Use Up Inventory 
5CSAP51-BLUInactive - Use Up Inventory 
6CSAP51CS-BLKInactive - Use Up Inventory 
7CSA11-BLUInactive - Use Up InventoryRation
Ration
Cell Formulas
RangeFormula
C2:C7C2=IF(AND(COUNTIF(A$2:A$7,A2)>1,B2="Inactive - Use Up Inventory"),"Ration","")
 
Upvote 0
Like this?
One more question formula works fine when all stock types are "Inactive - Use Up Inventory" however it doesn't work if one of them is "Inactive - Use Up Inventory" and the other is "Active - Use Up Inventory" Is there any way it only flags where both conditions meets for both columuns.

20 11 20.xlsm
ABC
1CCP NameStock TypeOutput
2CSA11-BLKActive - Use Up Inventory 
3CSA11-BLUInactive - Use Up InventoryRation
4CSAP51-BLKInactive - Use Up Inventory 
5CSAP51-BLUInactive - Use Up Inventory 
6CSAP51CS-BLKInactive - Use Up Inventory 
7CSA11-BLUInactive - Use Up InventoryRation
Ration
Cell Formulas
RangeFormula
C2:C7C2=IF(AND(COUNTIF(A$2:A$7,A2)>1,B2="Inactive - Use Up Inventory"),"Ration","")
 
Upvote 0
Is there any way it only flags where both conditions meets for both columuns.
OK, there wasn't one like that in the samples. ;)
Try
Excel Formula:
=IF(COUNTIFS(A$2:A$7,A2,B$2:B$7,"Inactive - Use Up Inventory")>1,"Ration","")
 
Upvote 0
OK, there wasn't one like that in the samples. ;)
Try
Excel Formula:
=IF(COUNTIFS(A$2:A$7,A2,B$2:B$7,"Inactive - Use Up Inventory")>1,"Ration","")
This works when there is only 2 rows of duplicate data however doesn't work when there is 3 or more. Please see below.
In the below example, CSA11-BLK shouldn't be flagged as Ration as one of the corresponding values under Stock Type is Active-Use Up Inventory. Is there any way to make the formula work when both conditions meet and apply to all rows?

CCP NameStock TypeOutput
CSA11-BLK​
Inactive - Use Up InventoryRation
CSA11-BLU​
Inactive - Use Up InventoryRation
CSA11-BLK​
Active - Use Up InventoryRation
CSA11-BLK​
Inactive - Use Up InventoryRation
CSAP51CS-BLK​
Inactive - Use Up Inventory
CSA11-BLU​
Inactive - Use Up InventoryRation
 
Upvote 0
Oops, missed one check, sorry. Try again.

20 11 20.xlsm
ABC
1CCP NameStock TypeOutput
2CSA11-BLKInactive - Use Up InventoryRation
3CSA11-BLUInactive - Use Up InventoryRation
4CSA11-BLKActive - Use Up Inventory 
5CSA11-BLKInactive - Use Up InventoryRation
6CSAP51CS-BLKInactive - Use Up Inventory 
7CSA11-BLUInactive - Use Up InventoryRation
Ration (3)
Cell Formulas
RangeFormula
C2:C7C2=IF(AND(B2="Inactive - Use Up Inventory",COUNTIFS(A$2:A$7,A2,B$2:B$7,"Inactive - Use Up Inventory")>1),"Ration","")
 
Upvote 0

Forum statistics

Threads
1,214,642
Messages
6,120,701
Members
448,980
Latest member
CarlosWin

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