Formula help - duplicate values with conditions in columns

supdawg

Well-known Member
Joined
Mar 18, 2007
Messages
608
So Im looking for a formula to figure out if my numbers are duplicates in column a and then check a 2nd condition to categorize them.

An order can be one of three conditions. Pure CSP, Pure ACT and a mix of the two.

Here's a sample of data and expected output in column C:

Need to check the entire range for duplicates and return a value in C that is based on the condition of whats in column b. Can't seem to figure out an easy way to do this.

Speed is a concern as my data set will likely have 20-30k rows.

DuplicateConditionResult
676278324CSPCSP
676278118ACTACT
676278118ACTACT
676278118ACTACT
676278118ACTACT
676207794CSPMIX
676207794CSPMIX
676207794ACTMIX
676270032CSPCSP
676268309CSPCSP
676272582CSPCSP
676280866ACTMIX
676280866ACTMIX
676280866CSPMIX

<tbody>
</tbody>
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
DuplicateConditionResultDuplicateCondition
676278324CSPCSP676278324CSP
676278118ACTACT676278118ACT
676278118ACTACT676278118ACT
676278118ACTACT676278118ACT
676278118ACTACT676278118ACT
676207794CSPMIX676207794CSPCount of Duplicate
676207794CSPMIX676207794CSPDuplicateTotal
676207794ACTMIX676207794ACT6762077943
676270032CSPCSP676270032CSP6762683091
676268309CSPCSP676268309CSP6762700321
676272582CSPCSP676272582CSP6762725821
676280866ACTMIX676280866ACT6762781184
676280866ACTMIX676280866ACT6762783241
676280866CSPMIX676280866CSP6762808663
Grand Total14
ACTCSPMIX
67620779412yes
67626830901no
67627003201no
67627258201no
67627811840no
67627832401no
67628086621yes
I used a helper pivot table to list all numbers
then sumproduct to count the ACT's and CSP's
and finally checked if number of ACT multiplied by CSP
was not zero

<colgroup><col><col span="5"><col><col span="3"><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
What was the sumproduct formula you used? And is there a way to do this without using a pivot table?
 
Upvote 0
I am sure there is- I went for a simple approach - the sumproduct is (number in number column x CSP in condition column)
 
Upvote 0
Try this in cell C2 and copy down:

=IF(COUNTIF($A$2:$A$15,A2)-COUNTIFS($A$2:$A$15,A2,$B$2:$B$15,B2),"MIX",B2)
 
Upvote 0
Try this in cell C2 and copy down:

=IF(COUNTIF($A$2:$A$15,A2)-COUNTIFS($A$2:$A$15,A2,$B$2:$B$15,B2),"MIX",B2)

Hello and thank you kind sir.. This formula does the trick, however it appears to be a bit slow.

Can anyone think of a solution that would calculate faster?

My data set may have 30,000 rows and this formula would take a couple of minutes to run on my system.
 
Upvote 0

Forum statistics

Threads
1,203,203
Messages
6,054,110
Members
444,702
Latest member
patrickmg17

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