Count Unique Value combinations with Conditions

jrc1115

New Member
Joined
Jan 2, 2014
Messages
3
Hello Mr. Excel!

I have a fairly large data set that i'm working with and I am trying to determine the number of unique combinations given a certain criteria. I have 3 fields i'm trying to compare, Active ("Y" or "N"), Customer Name (there are many different names), Project (there are many different projects). There are multiple appearances of "Customer Name" and "Project" from other fields in my data set.

In the 4th column, I'm trying to output a "0" if Active is "N", and a "1" for the first unique combination of Customer Name and Project and "0" for the remaining duplicates. The total dataset is ~4000 rows but this the main problem i'm desperate to solve!

So far, i've tried this which returns a "0" when Active is "N" but I get "#VALUE" when Active is "Y". Any suggestions on how to solve this? This would be copied and pasted in cell D2 and pasted down through the dataset.


=IF(A2="Y",IF(SUMPRODUCT(($B$2*$B2=B2)*($C$2*$C2=C2))>1,0,1),0)

Active
Customer Name
Project
Active Count
N
Customer 1
A
N
Customer 1
A
Y
Customer 1
B
Y
Customer 1
B
Y
Customer 1
B
Y
Customer 1
C
Y
Customer 1
C
N
Customer 2
AA
N
Customer 2
AA
N
Customer 2
AA
Y
Customer 2
BB
Y
Customer 2
BB
Y
Customer 2
BB

<tbody>
</tbody>

Thanks a lot for the help!!

Josh
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Try this:

Code:
In D2

=IF($A2="N",0,--(SUMPRODUCT(-($B$2:$B2=$B2),-($C$2:$C2=$C2),--($A$2:$A2="Y"))=1))

Markmzz
 
Last edited:
Upvote 0
One more...

,=IF(A2="N",0,IF(SUMPRODUCT(--(A$2:A2 < > "N"),--(B$2:B2=B2),--(C$2:C2=C2))=1,1,0))

<colgroup><col></colgroup><tbody>
</tbody>
 
Upvote 0
Another way (with a small modification in your formula):

Layout

ActiveCustomer NameProjectActive Count
NCustomer 1A0
NCustomer 1A0
YCustomer 1B1
YCustomer 1B0
YCustomer 1B0
YCustomer 1C1
YCustomer 1C0
NCustomer 2AA0
NCustomer 2AA0
NCustomer 2AA0
YCustomer 2BB1
YCustomer 2BB0
YCustomer 2BB0
*******************************************

<tbody>
</tbody>

Formula

Code:
In D2

=IF($A2="Y",1*(SUMPRODUCT(-($B$2:$B2=$B2),-($C$2:$C2=$C2))=1),0)

Markmzz
 
Upvote 0
A small modification in my last formula:

Code:
In D2

=($A2="Y")*(SUMPRODUCT(-($B$2:$B2=$B2),-($C$2:$C2=$C2),--($A$2:$A2="Y"))=1)

Markmzz
 
Upvote 0

Forum statistics

Threads
1,214,591
Messages
6,120,429
Members
448,961
Latest member
nzskater

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