Search code examples
if-statementgoogle-sheetsfiltersumsumifs

Google Sheets: Sum a Value Range Within a Specified Time Frame


I'm trying to sum a range of values, within a given time frame. The time frame could be x hours, or y days, etc. An example: enter image description here

So for each row, I need to sum the last hours or days as specified in cells C2:E2, which are numeric (just added formatting to show the text). Note that the datetime values do not follow any interval pattern, but are always sequential.

Although I've tried searching SO, and via Google, I haven't been able to find a way to do this.

Any suggestions would be very welcome.

[Edit] I've added to a link to an example sheet of what I'm trying to do... pls just ask if I can add any further info! Test Sum By Time


Solution

  • try:

    =SUMIFS(B3:B, A3:A, ">="&NOW()-1)
    

    =SUMIFS(B3:B, A3:A, ">="&NOW()-7)
    

    enter image description here