summing values in a data table based on criteria in another column

G

Guest

I have a data table whose columns are arranged in the following manner, from
left to right:

Date | ArriveTime | LeaveTime |Hours | Overtime | Regular | Gross |
RunningGross | CumHours | $/Week

What I'm looking to do is sum the "Gross" column based on a period of dates,
say 8/1/06 through 8/31/06, and not select this range manually.

The Date column is column D and the Gross column is column J.

Ideas?
 
C

Carim

Hi Dave,

Something along this line :

=SUMIF(D2:C100,">"& DATE(2006,7,31),J2:E100) -
SUMIF(D2:C100,">"& DATE(2006,8,31),J2:E100)

HTH
Cheers
Carim
 
G

Guest

=SUMPRODUCT(--(D2:D100>=StartDate),--(D2:D100<=End date),(J2:J100))

where start/End dates are cells containing these values.

If you want to sum a calendar month e.g August:

=SUMPRODUCT(--(MONTH(D2:D100)=8),J2:J100)

HTH
 
G

Guest

Wow, that's great, thanks.

I ended up using the following:
=SUMPRODUCT(--(D13:D166>=DATE(2006,7,1)),--(D13:D166<=DATE(2006,7,31)),(J13:J166))

Thanks.

Dave
 
K

Ken Wright

A better option might be to those dates into 2 cells and then just reference
the cells instead of hardcoding them into the formula like that. It's then
obvious at a glance as to what thye parameters of the query are.

--
Regards
Ken....................... Microsoft MVP - Excel
Sys Spec - Win XP Pro / XL 97/00/02/03

------------------------------­------------------------------­----------------
It's easier to beg forgiveness than ask permission :)
------------------------------­------------------------------­----------------
 
G

Guest

Well those values are hard-coded, in the Dates column, however, when I enter
the dates in that manner I get a #VALUE! error. When I use the
DATE(2006,7,1) function I don't.
 
K

Ken Wright

The following will work fine as long as the dates in Z1 and Z2 are real
dates:-

=SUMPRODUCT(--(D13:D166>=$Z$1),--(D13:D166<=$Z$2),(J13:J166))

Regards
Ken........................
 

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