Compound conditional in "SumIf"

R

RWN

I'm trying to sum the values in Col E where the value in Col A falls in
a range as defined by G4 and H4.
The "A" and "G/H" values are dates.
G4 is the low value and H4 is high.

If I use =SUMIF(A:A,">="&G4,E:E) it returns the correct value.
If I use =SUMIF(and(A:A,">="&G4,A:A,"<="&H4),E:E), it tells me I've got
an error in the formula.

The Help on a SumIf function makes no reference to using a compound
condition, so I assume therefore that it can't handle it.
Question is, how(or can) I do this without resorting to VBA?
 
D

Dave Peterson

One way (although you can't use a whole column):

=SUMPRODUCT(--(A1:A100>=G4),--(A1:A100<=H4),E1:E100)
 
R

RWN

Thanks Dave;

I'll file this for future ref. (actually I have to upgrade my education
with that function- as well as about a million more by the looks of
it!).

I solved my problem by simply summing the E col then subtracting the
Sumif's (one checking High, the other Low).
Probably not the most "elegant" way of doing it but I didn't want to
have to specify a row range, and it works!
 

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

Top