CountIF based on unique values

wangaa11

New Member
Hello, I am trying to count the number of times "positive" occurs however the positive could occur duplicate times for a unique value and I only want to count the positive the one time in that instance.

For example and I would attach an actual example but it for whatever reason isn't working so I hope this will do.

H235 Negative
HA260 Negative
H235 Positive
H789 Positive
HA852 Negative
HA951 Negative
HA951 Negative
HA951 Positive
H235 Positive

I should only have 3 "positives" as H235 & HA951 has a duplicate positive

I should note there are over hundreds of rows of data which has a number of unique H values in that first "column" Any assistance on this is greatly appreciated

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.

Fluff

MrExcel MVP, Moderator
+Fluff v2.xlsm
ABCD
1
2H235Negative3
3HA260Negative
4H235Positive
5H789Positive
6HA852Negative
7HA951Negative
8HA951Negative
9HA951Positive
10H235Positive
11
Master
Cell Formulas
RangeFormula
D2D2=SUM(--(FREQUENCY(IF(B2:B10="Positive",MATCH(A2:A10,A2:A10,0)),ROW(A2:A10)-ROW(A2)+1)>0))
Press CTRL+SHIFT+ENTER to enter array formulas.

wangaa11

New Member
+Fluff v2.xlsm
ABCD
1
2H235Negative3
3HA260Negative
4H235Positive
5H789Positive
6HA852Negative
7HA951Negative
8HA951Negative
9HA951Positive
10H235Positive
11
Master
Cell Formulas
RangeFormula
D2D2=SUM(--(FREQUENCY(IF(B2:B10="Positive",MATCH(A2:A10,A2:A10,0)),ROW(A2:A10)-ROW(A2)+1)>0))
Press CTRL+SHIFT+ENTER to enter array formulas.
thank you for the help however I am still getting a value error and I even used the sample that you provided with the exact same setup and I am getting an error

wangaa11

New Member
+Fluff v2.xlsm
ABCD
1
2H235Negative3
3HA260Negative
4H235Positive
5H789Positive
6HA852Negative
7HA951Negative
8HA951Negative
9HA951Positive
10H235Positive
11
Master
Cell Formulas
RangeFormula
D2D2=SUM(--(FREQUENCY(IF(B2:B10="Positive",MATCH(A2:A10,A2:A10,0)),ROW(A2:A10)-ROW(A2)+1)>0))
Press CTRL+SHIFT+ENTER to enter array formulas.
However what is interesting is if I move the formula down to D4 I get a 1?

Fluff

MrExcel MVP, Moderator

What error are you getting?
Also did you confirm the formula with Ctrl Shift Enter?

wangaa11

New Member
What error are you getting?
Also did you confirm the formula with Ctrl Shift Enter?
I am getting a #Value! error.

It worked. I did ctrl shift enter incorrectly. It is working now thank you.

Fluff

MrExcel MVP, Moderator
You're welcome & thanks for the feedback.

Fluff

MrExcel MVP, Moderator
For future reference
While we do allow Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered elsewhere.

Replies
1
Views
123
Replies
2
Views
75
Replies
4
Views
139
Replies
2
Views
61
Replies
8
Views
157

1,127,861
Messages
5,627,315
Members
416,239
Latest member
Counselor85027

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.

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

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