Google表格:如何计算当前工作周中的数组条目?

时间:2019-03-14 19:13:17

标签: google-sheets

我有一个电子表格,其中一列(H2:H500)中有数据,日期则在另一列(F2:F500)中。我想要过去一个工作周(星期一至星期五)的总数的总和。我不确定是否需要使用=CountIfs或什么。任何帮助将不胜感激!

=COUNTIFS(F2:F500,WEEKNUM(TODAY(),1),H2:H500, "<>") 

...似乎无效。我要关闭吗?

1 个答案:

答案 0 :(得分:1)

=COUNTA(QUERY({A2:B}, 
 "select Col1 
  where Col2 is not null 
    and Col1 >= date '"&TEXT(DATE(YEAR(TODAY()),1,1)-WEEKDAY(DATE(YEAR(TODAY()),1,1),3)+7*
           (WEEKDAY(DATE(YEAR(TODAY()),1,1),3)>3)+7*(WEEKNUM(TODAY())-2),"yyyy-mm-dd")&"' 
    and Col1 <= date '"&TEXT(DATE(YEAR(TODAY()),1,1)-WEEKDAY(DATE(YEAR(TODAY()),1,1),3)+7*
           (WEEKDAY(DATE(YEAR(TODAY()),1,1),3)>3)+7*(WEEKNUM(TODAY())-2)+4,"yyyy-mm-dd")&"'"))

0