Home » excel » excel – How many pairs of cells spreadsheet are non-empty?

# excel – How many pairs of cells spreadsheet are non-empty?

Questions:

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.

COUNTIFS should do this handily.

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

``````=COUNTA(IFERROR(QUERY(A:B, "select A where A is not null and B is not null")))
`````` ``````=COUNTA(IFERROR(FILTER(A:A,A:A<>"",B:B<>"")))
`````` # 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)))
``````