【问题标题】:Sumifs formula with dynamic date range is not working in google sheet具有动态日期范围的 Sumifs 公式在谷歌表中不起作用
【发布时间】:2019-05-03 05:41:52
【问题描述】:

这里 O 列是我的总和范围, P2 = 日期,即2019-05-02

我想在过去 30 天的基础上对所有 O 列范围求和。即p2-30

此公式在 Excel 中运行良好,但在 Google 表格中无法运行。

=SUMIFS(O:O,C:C,C2,P:P,"<"&TEXT(P2-30,"yyyy-mm-dd"))

我对此真的很陌生,如果有任何提示,我将不胜感激.....

【问题讨论】:

    标签: google-sheets google-sheets-formula google-sheets-query


    【解决方案1】:

    您可能想尝试一下 QUERY 函数。

    F1:  =text(today()-30;"yyyy-mm-dd")
    H1:  =query(O1:P18;"Select sum(O) where P> date '"&F1&"'")
    

    如果你不想要标题

    H1: =query(O1:P18;"Select sum(O) where P> date '"&F1&"' label sum(O) ''")
    

    QUERY 是一个非常好的功能。使用日期可能有点棘手,请查看 https://www.benlcollins.com/spreadsheets/query-dates/ 的示例

    【讨论】:

      【解决方案2】:
      =SUMPRODUCT(QUERY(O1:P, "select O 
                               where P <= date '"&TEXT(C2, "yyyy-MM-dd")&"'
                                 and P >= date '"&TEXT(C2-30, "yyyy-MM-dd")&"'", 0))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-05-28
        • 1970-01-01
        • 2014-04-21
        • 1970-01-01
        • 2020-08-14
        • 1970-01-01
        相关资源
        最近更新 更多