I'm writing a COUNTIF
to count the number of rows between two columns where at least one of the cells in the row is not blank. The logic is as follows:
COUNTIF($A:$A OR $B:$B, "<>"&"")
I know I can't nest an OR
within a COUNTIF
, but is there something else I can do? I am familiar with using an array when you have multiple criteria, but I don't believe that works for ranges.
答案 0 :(得分:3)
You need to do two COUNTIF an one COUNTIFS:
=COUNTIF(A:A,"<>")+COUNTIF(B:B,"<>")-COUNTIFS(A:A,"<>",B:B,"<>")
Or you need to limit the data range to use SUMPRODUCT:
=SUMPRODUCT(--((A1:A1000<>"")+(B1:B1000<>"")>0))