Google-sheets – COUNTIFS with multiple OR

formulasgoogle sheetsgoogle-sheets-arrayformulagoogle-sheets-queryregex

I have two sheets, one is a dump sheet of values like below:
enter image description here

and the second sheet is using values from this to the total.
enter image description here

I am trying to get the total count for the corresponding zone and test name but only if the clash status column says "New" or "Active".

I've tried multiple ways but I am not getting the syntax correct, can anyone help?

Best Answer

countifs

One way is to use countifs(..., D:D, "New") + countifs(..., D:D, "Active") -- addition works as long as the options in OR are mutually exclusive.

filter

More generally, the combination counta(filter(...)), which is more powerful than countifs, can express OR logic by addition:

=counta(filter(A:A, A:A = "name", B:B = "zone", (D:D = "New") + (D:D = "Active"))

query

Yet more generally, query can return such results for all names and zones at once:

=query(A:D, "select A, B, count(D) where D = 'New' or D = 'Active' group by A, B', 1)

Further reading: filter, query.