Sweepster
Sweepster

Reputation: 1949

Excel count rows where column B equals value and value in column A is not a duplicate

I have a table as follows:

A B
1 happy
1 sad
2 angry
2 sad
3 sad
4 moody
4 thoughtful
5 excited

I need to count the number of times "sad" appears in column B whose value in column A is NOT a duplicate.

I am aware of =COUNTIF(B2:B8, "sad") but I'm stuck there.

Our answer should be 1 since sad only occurs once without a duplicate in A.

Thank you.

Upvotes: 0

Views: 47

Answers (1)

Scott Craner
Scott Craner

Reputation: 152585

Use SuMPRODUCT with a COUNTIFS():

=SUMPRODUCT((B1:B8="Sad")*(COUNTIF(A1:A8,A1:A8)=1))

enter image description here

Upvotes: 2

Related Questions