Google张查询两个日期之间的总和

Google sheets query sum total between two dates

我有一个看起来像这样的电子表格。

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

是否可以使用 google 工作表查询来计算两个日期之间的总数,即 2020-05-01 和 2020-05-05 之间的总数为 154?

我知道可以搜索大于/小于日期,但不确定如何对返回的总数求和?

假设日期在 A 列中,尝试

=query(A2:B, "Select sum(B) where A >= date '2020-05-01' and A <= date '2020-05-05' label sum(B)''", 0)

或者,使用 sumproduct:

=sumproduct(A2:A>=date(2020, 5, 1), A2:A<=date(2020, 5, 5), B2:B)

或者,使用求和:

=sumifs(B2:B, A2:A, ">="&date(2020, 5, 1), A2:A, "<="&date(2020, 5, 5))

尝试:

=SUMIFS(B1:B, A1:A, ">="&DATEVALUE("2020-05-01"), 
              A1:A, "<="&DATEVALUE("2020-05-05"))