K
kc0hwa
how to do a double lookup
countif($a$3:$a30,4) and ($b$3:$b30,5)
I know countif is countif(range,==)
but I need look in
countif($a$3:$a30,4) and ($b$3:$b30,5)
I know countif is countif(range,==)
but I need look in
how to do a double lookup
countif($a$3:$a30,4) and ($b$3:$b30,5)
I know countif is countif(range,==)
but I need look in
kc0hwa said:how to do a double lookup
countif($a$3:$a30,4) and ($b$3:$b30,5)
If you want to count only the instances when both conditions are met in the
same row, then:
* For XL2007 and later:
COUNTIFS($a$3:$a30,4,$b$3:$b30,5)
* For XL2003 and earlier:
SUMPRODUCT(($a$3:$a30=4)*($b$3:$b30=5))
If you want to count when either condition is met, and you want to avoid
double-accounting when both conditions are met in the same row, then:
SUMPRODUCT(--(($a$3:$a30=4)+($b$3:$b30=5)>0))
The double-negative (--) converts TRUE and FALSE to 1 and 0, which
SUMPRODUCT requires.
Multiplication of conditional expressions acts like AND(). Addition acts
like OR(). We cannot use AND() and OR() in this context for the purposes
described above.
kc0hwa said:[....]* For XL2007 and later:
COUNTIFS($a$3:$a30,4,$b$3:$b30,5)
* For XL2003 and earlier:
SUMPRODUCT(($a$3:$a30=4)*($b$3:$b30=5)) [....]
SUMPRODUCT(--(($a$3:$a30=4)+($b$3:$b30=5)>0))
if the cell, is string will this work
kc0hwa said:[....]* For XL2007 and later:
COUNTIFS($a$3:$a30,4,$b$3:$b30,5)
* For XL2003 and earlier:
SUMPRODUCT(($a$3:$a30=4)*($b$3:$b30=5)) [....]
SUMPRODUCT(--(($a$3:$a30=4)+($b$3:$b30=5)>0))
if the cell, is string will this work
The COUNTIFS works regardless of whether the cell content is text or
numeric.
The SUMPRODUCT needs to be changed as follows:
SUMPRODUCT(($a$3:$a30="4")*($b$3:$b30="5"))
or
SUMPRODUCT(--(($a$3:$a30="4")+($b$3:$b30="5")>0))
If you have further questions, please indicate what version of Excel you are
using (XL2003, XL2007, XL2010, etc) and which solution best fits your needs:
COUNTIFS, SUMPRODUCT with "*", or SUMPRODUCT with "+".
That way, I do not have to duplicate so many things.
kc0hwa said:[....]* For XL2007 and later:
COUNTIFS($a$3:$a30,4,$b$3:$b30,5)
* For XL2003 and earlier:
SUMPRODUCT(($a$3:$a30=4)*($b$3:$b30=5)) [....]
SUMPRODUCT(--(($a$3:$a30=4)+($b$3:$b30=5)>0))
if the cell, is string will this work
The COUNTIFS works regardless of whether the cell content is text or
numeric.
The SUMPRODUCT needs to be changed as follows:
SUMPRODUCT(($a$3:$a30="4")*($b$3:$b30="5"))
or
SUMPRODUCT(--(($a$3:$a30="4")+($b$3:$b30="5")>0))
If you have further questions, please indicate what version of Excel you are
using (XL2003, XL2007, XL2010, etc) and which solution best fits your needs:
COUNTIFS, SUMPRODUCT with "*", or SUMPRODUCT with "+".
That way, I do not have to duplicate so many things.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.