Reputation: 34376
I have a spreadsheet that looks like this.
2020-04-25 63
2020-04-26 34
2020-04-27 12
2020-04-28 33
2020-04-29 45
2020-04-30 10
2020-05-01 34
2020-05-02 12
2020-05-03 45
2020-05-04 18
2020-05-05 45
2020-05-06 21
2020-05-07 34
2020-05-08 56
2020-05-09 21
Is it possible to use a google sheets query to sum the total between two dates, between 2020-05-01 and 2020-05-05 the total would be 154?
I understand it's possible to search greater than / less than dates, but unsure how to sum the returned total?
Upvotes: 1
Views: 1696
Reputation: 1
try:
=SUMIFS(B1:B, A1:A, ">="&DATEVALUE("2020-05-01"),
A1:A, "<="&DATEVALUE("2020-05-05"))
Upvotes: 1
Reputation: 27282
Assuming dates in column A, try
=query(A2:B, "Select sum(B) where A >= date '2020-05-01' and A <= date '2020-05-05' label sum(B)''", 0)
Or, using sumproduct:
=sumproduct(A2:A>=date(2020, 5, 1), A2:A<=date(2020, 5, 5), B2:B)
or, using sumifs:
=sumifs(B2:B, A2:A, ">="&date(2020, 5, 1), A2:A, "<="&date(2020, 5, 5))
Upvotes: 2