Timothy Armstrong
Timothy Armstrong

Reputation: 2062

How can I count non-empty cells based on a value elsewhere in the row?

I have a table like this:

+---+---------+----------+--------+
|   |    A    |    B     |   C    |
+---+---------+----------+--------+
| 1 | John    | Judy     | Team A |
| 2 | Brandon | Bethany  | Team B |
| 3 | Agnes   |          | Team A |
| 4 | William | Welma    | Team B |
| 5 | Tom     | Theresa  | Team B |
| 6 | Peter   |          | Team A |
+---+---------+----------+--------+

Counting the total number of people is easy:

=COUNTA(A1:B6) -> 10

How can I count the number of people on each of the teams? i.e., Team A is 4, Team B is 6.

Upvotes: 0

Views: 31

Answers (1)

cdhowie
cdhowie

Reputation: 169528

You can combine COUNTA() with FILTER() to achieve this result:

=COUNTA(FILTER(A:B, C:C="Team A")) -> 4
=COUNTA(FILTER(A:B, C:C="Team B")) -> 6

Upvotes: 1

Related Questions