I want to know how many times 2 corresponding cells meet a conditi

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have 2 columns of numbers I would like to know how many times the value in
column A meets a certain value in column B.
ex)
column A column B
row1 1 2
row2 1 2
row3 1 2

How many times does the value 1 in column A match the corrspond value of 2
in column B. For clarity in this example it occurs 3 times?
 
=SUMPRODUCT(--(A1:A5=1),--(B1:B5=2))

Or

=SUMPRODUCT(--(A1:A5=C1),--(B1:B5=D1))

where C1=1, D1=2
 
=SUMPRODUCT(--(A1:A3=1),--(B1:B3=2))

The 1 and the 2 are hardcoded into this formula, but can just as easily
reference other cells with those values.
 
Thank you I appreciate it those of you who replied. What does the -- mean
I'm not familiar with those
 
They just convert the Boolean values TRUE or FALSE into 1 or 0 thus you can
use SUMPRODUCT's built in format as opposed to multiplying the ranges with
each other. You can use 0+ or 1* or N as well


--

Regards,

Peo Sjoblom

http://nwexcelsolutions.com
 
Back
Top