2rrs said:
I attempted to use the SUMPRODUCT formula and the COUNTIF formula on
the table below with the following results:
=SUMPRODUCT(($F$159:$F166<=29)*(H$159:$H$166>10))............returns 2
=COUNTIF($F$159:$F$166,"<=29")+COUNTIF($H$159:$H$166,">10")..returns 10 ....
10 is the correct answer, do you see any flaws in the setup? ....
....
What you originally asked for an what you say is the correct answer aren't
the same thing. Rows in which col C <= 29 *AND* E > 10 means rows in which
*BOTH* conditions hold. The COUNTIF formula above doesn't combine the
criteria. It gives the number of rows in col F <= 29 plus the number of rows
in col H > 10, which is neither satisfying criteria col F <= 29 AND col H >
10 nor col F >= 29 OR col H > 10.
To illustrate,
____F__H
1 2 5
2 3 6
3 4 3
=COUNTIF(F1:F3,"<=5")+COUNTIF(H1:H3,">4") returns 5, which is more than the
number of rows. Is this really what you want?
If not, then you need to use SUMPRODUCT (or equivalents).
AND criteria: =SUMPRODUCT((criterion1)*(criterion2))
OR criteria: =SUMPRODUCT(--((criterion1)+(criterion2)>0))