# 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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)

#### 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
191
Replies
2
Views
86
Replies
4
Views
187
Replies
2
Views
78
Replies
8
Views
174

1,130,093
Messages
5,640,072
Members
417,125
Latest member
sfreind

### 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.

### Which adblocker are you using?

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