SUMIF criteria - select a record with >, =, and <

P

PJB

This may be real basic - a basic syntax question.

I have records listed in rows. I have a column listing the age of a person
(column D). I want to select records on the basis of the range a person's age
falls into -- for example, ages 31 to 40. Once selected, I want to sum the
values in another column.

The following command is OK - selecting all those under age 31:
SUMIF(D1:D195,"<31",H1:H195)

I do not think this command is giving me an accurate count - selecting
records between 30 and 40 years of age:
SUMIF(D1:D195,">30*<41",H1:H195)

Am I on the right track?
 
D

Dav

Depending on if you mean < or <=

SUMIF(D1:D195,">30*<41",H1:H195)

SUMPRODUCT((D1:D195>30)*(D1:D195<41)*(H1:H195))

Should work

So I guess you were on the right lines

Regards

Dav
 
D

Don Guillett

try to count
=sumproduct((d1:d21>=31)*(d1:d21<40))
to sum
=sumproduct((d1:d21>=31)*(d1:d21<40),h1:h21)
 
Top