Search code examples
google-sheetssumgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Total by day in google sheets for a given month and year


I have the following table:

What I'm trying to do is to write a formula that totals by each unique day in the month and year given in B1 and C1 thus the output should be:

enter image description here

I'm not sure how to start with this, googling seems to suggest the use of SUMIF.

Sheet is here


Solution

  • try:

    =QUERY(FILTER({A5:B, TIMEVALUE(C5:C)}, MONTH(A5:A)=MONTH(B1&1), YEAR(A5:A)=D1), 
     "select Col1,sum(Col3) 
      where Col1 is not null 
      group by Col1 
      label sum(Col3)'' 
      format sum(Col3)'[hh]:mm'", 0)
    

    enter image description here