Stephan
Stephan

Reputation: 43033

How to count common cells (same value cells) from two different columns?

I have a sheet like below:

A     B
123    12
456    456   
11     11

I want to count the cells having the same value in column A and B. From the above example, I expect 2 (456 and 11 are both in column A and B).

Here are some formulas I tried without success:

=IF(A1:A3=B1:B3;1;0)           "Error..."
=COUNTIFS(A1:A3; "=" & B1:B3)  "Returns 0"

I don't want to use script.

Upvotes: 0

Views: 74

Answers (1)

JPV
JPV

Reputation: 27262

Try

=SUMPRODUCT(A:A<>"", A:A=B:B)

Upvotes: 1

Related Questions