Unsapiensaurus
Unsapiensaurus

Reputation: 79

Count unique rows with a criterion of multiple columns

The formula in B2:

=COUNTIF(FILTER(C3:D, C3:C=TRUE, D3:D=TRUE), TRUE)

enter image description here

But this formula counts a row only if in both columns C and D there's a TRUE value and in that case the row is counted as 2.

.

I have also tried

=FILTER(C3:D, OR(C3:C=TRUE, D3:D=TRUE))

but gives the error: #N/A FILTER has mismatched range sizes. Expected row count: 50498, column count: 1. Actual row count: 1, column count: 1.

What formula can I use in this case?

Upvotes: 0

Views: 55

Answers (2)

z..
z..

Reputation: 13131

The FILTER function performs an AND between the conditions, to simulate an OR you can add them instead.

=ROWS(FILTER(C3:D,C3:C+D3:D))

Note that the =TRUE is redundant since the values are already booleans.

You could also use SUMPRODUCT, like this:

=SUMPRODUCT(C3:C+D3:D>0)

Upvotes: 1

rockinfreakshow
rockinfreakshow

Reputation: 30289

You may try:

=countif(index(C3:C+D3:D),">0")

Upvotes: 1

Related Questions