0
votes

I'm trying to calculate weekly sums in a single column, but I'm having trouble writing the formula. I'm found the the weeknum for every date in the year, but I can't find a way to sum up values if they have the same weeknum.

Link to my spreadsheet: https://docs.google.com/spreadsheets/d/1WIeBpRndO9ZBlkCcWQuNO1X4e9I6bGeQiYDTZqhaOeA/edit#gid=0

I'd like column "D" to automatically calculate the weekly sum using an array formula -- is there a way to do this?

This thread introduces the problem: Calculate weekly and monthly total in spreadsheet.

2
You may use the WEEKNUM() function. - Luchostein

2 Answers

1
votes

Chang sum() to sumif()

=ARRAYFORMULA(IF(ROW(A:A)=1,"Weekly Sum", IF(WEEKDAY(A:A)=7, sumif(C:C,C:C,B:B),)))
0
votes

You have: A2:A with dates and B2:B with values. So:

F2=arrayformula(if(isblank(A2:A),,weeknum(A2:A)))
G2=if(F2<>F1,sum(iferror(filter(B$2:B,F$2:F=F2),0)),0)

And then copy G2 through G3:G.