'How many pairs of cells spreadsheet are non-empty?

I have cells in columns A and B. I am interested in the cases in which neither the cell in column A nor its neighbour in column B is empty. (For example, when cells A12 and B12 both contain something.)

How can I count the number of times both cells in a pair are non-empty?

So far, I've had a column C, with each cell having =IF(OR(ISBLANK(A2),ISBLANK(B2)), 0, 1), =IF(OR(ISBLANK(A3),ISBLANK(B3)), 0, 1), etc. with a SUM function at the bottom of Column C, but I am wondering if there is a more efficient way to count these.



Solution 1:[1]

COUNTIFS should do this handily.

=countifs(a:a, "<>", b:b, "<>")

Solution 2:[2]

=COUNTA(IFERROR(QUERY(A:B, "select A where A is not null and B is not null")))

0

Solution 3:[3]

=COUNTA(IFERROR(FILTER(A:A,A:A<>"",B:B<>"")))

0

Solution 4:[4]

SUMPRODUCT 'Deals' in Arrays 4

Calculates (counts) the number of rows where cells in column A AND column B, contain data.

=SUMPRODUCT(--NOT(ISBLANK(A$1:A$5000)),--NOT(ISBLANK(B$1:B$5000)))

Calculates (counts) the number of rows where cells in column A AND column B, are blank.

=SUMPRODUCT(--ISBLANK(A$1:A$5000),--ISBLANK(B$1:B$5000))

Would appreciate anyone's feedback if the following formula is working and in which Excel version (not working in 2003):

=SUMPRODUCT(--NOT(ISBLANK(A:A)),--NOT(ISBLANK(B:B)))

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 player0
Solution 3 player0
Solution 4