Google Sheets – Cumulative Sum of Grouped Values

formulasgoogle sheetsgoogle-sheets-query

I found it a bit hard to phrase this question, so here's a screenshot:

My timesheet

I'm trying to create a timesheet for our employees and would like to have a cumulative sum function that sums up the number of hours worked in each week. This should be automatic, depending on the calendar week (first column).

So, for instance, I would like to sum up all hours worked in week 4, but if someone were to work for only two days, the formula would have to work too.

Is that possible using a formula?

Best Answer

=SUMPRODUCT(QUERY(A$2:F, "select F where A matches '"&INDIRECT("A"&ROW())&"'"))

1