COUNTIF & Criteria

D

David Lipetz

I'm using the SUMIF function to add numbers in a range that meet a given
criteria. The criteria I need to use is a range of numbers (>=1 and <=5, >=6
and <=10, etc).

While I have been able to perform this calculation by hard coding in the
parameters (">=1" and ">5" for example), I am unable to complete the formula
if I want to use cell references for the criteria.

Here is the whole formula that currently works by hard coding in the
criteria:

=COUNTIF(Revised!$A$2:$A$336,">=1")-COUNTIF(Revised!$A$2:$A$336,">5")

In other words, I want to use >=G2 rather than >=1 and use >I2 rather than

How do I accomplish this?

Thanks,
David
 
P

Peo Sjoblom

Try

=COUNTIF(Revised!$A$2:$A$336,">="&G2)-COUNTIF(Revised!$A$2:$A$336,">"&I2)

otherwise excel sees it as you are looking for the text G2 and I2
 
D

David Lipetz

Thanks Peo! That worked, but now I have another problem.

I wanted to create this as an array formula so that the criteria is selected
from each row: G2 & I2, G3 & I3, and so forth. With the & in front of the
cell reference, it uses that same reference throughout the array.
 
P

Peo Sjoblom

I am not sure I understand, but maybe

=SUM(COUNTIF(Revised!$A$2:$A$336,">="&G2:G336))-SUM(COUNTIF(Revised!$A$2:$A$
336,">"&I2:I336))

needs to be array entered with ctrl + shift & enter
 
D

David Lipetz

Thanks again! The actual formula is:
=SUMIF(Revised!$A$2:$A$335,">="&A2:A8,Revised!$L$2:$L$335)-SUMIF(Revised!$A$2:$A$335,">"&C2:C8,Revised!$L$2:$L$335)
 

Ask a Question

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.

Ask a Question

Similar Threads

MIN function 6
Excel Need Countifs Formula Help 0
Countif, index and match 2
age group 7
COUNTIF with multiple criteria 1
Countif time syntax 6
Modify range in VBA 9
Access Dcount (multiple criteria) 3

Top