Caveman42
Caveman42

Reputation: 709

Counting values where 2 columns are meet a criteria

I want to be able to count the amount of times a person (Name) appears with the answer yes or no in excel. Here is what my table basically looks like

Name  | Answer
Greg  |  YES
Steve |  YES
Jim   |  NO
Greg  |  NO
Greg  |  YES
Steve |  NO

So I want to be able to count the amount of times Greg responded 'YES' and 'NO'. So I should be getting 'YES' 2 times.

I've tried vlookups and countif but I'm not really sure how to combine the 2 columns to get a count or when one equals the other. Can anyone help me with this?

I've also tried:

=SUMPRODUCT((A2:A6="Greg")*(B2:B6="YES"))

But I get the error "Range has no entry corresponding to this cell"

Upvotes: 0

Views: 1888

Answers (2)

Dmitry Pavliv
Dmitry Pavliv

Reputation: 35843

I'm also using Google docs

If you are using google-spreadsheets, try this one:

=ARRAYFORMULA(SUMPRODUCT((A2:A6="Greg")*(B2:B6="YES")))

Upvotes: 3

hstay
hstay

Reputation: 1439

Try with COUNTIFS

=COUNTIFS(A2:A7, "Greg", B2:B7, "YES")

Upvotes: 1

Related Questions