View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Summing by weeks

=SUMPRODUCT(--(1+INT(($A$2:$A$200-(DATE(YEAR($A$2:$A$200),1,2)
-WEEKDAY(DATE(YEAR($A$2:$A$200),1,1))))/7)=week_num),$B$2:$B$200)

replace week_num by 1, 2 and so on.


--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"jzingman" wrote in message
...
Maybe I wasn't clear. I have a set of dates in the first column, and I
want
to sum the values in the second column that occurred during the first
week,
and then those that occurred during the second week, etc. In other words,
I
want a weekly sum of the values in the second column. There may be 0, 1 ,
or
more events each week.

"bj" wrote:

one way to do it would be to put in a column such that row 1 would be
week
one , row 2 would be week etc
then use sumproduct()
=sumproduct(--(weeknum(A1:A100)=row()),B1:b100)

"jzingman" wrote:

I've seen a few posts along this line, but I haven't figured out a good
solution. I want to sum by weeks of the year:

=sumif(weeknum(a1:a100), "=1", b1:b100)

But this doesn't work since you can't have weeknum there. I want this
for
every week, and I'd like to make it more general, so I don't really
want to do

=sumif(a1:a100, "1/1/2007" AND < "1/8/2007", b1:b100)

for each week of the year.
Is there a general way to do this?

Thanks