Google 工作表查询计数返回 'count' 而不是数值

Google Sheets QUERY count returning 'count' instead of numeric value

First-time sheets 查询用户所以请原谅菜鸟问题。我有一个带有多个选项卡的 Google sheet(文档)。我正在尝试跨包含 sheet 的选项卡进行查询。我发现不需要 IMPORTRANGE,因为数据来自同一来源(如果我错了,请纠正我)。

指定年月的查询、抓取计数。 emp1 是选项卡名称来源的数据:

  =QUERY('emp1'!B2:B,"Select COUNT(B) where month(B)=3 and year(B)=2019",0)

示例行数据(B2为起始数据行,跳过headers B1):

    A    B                 C           D            E
  Index Date        Company Name    Account #   Verified (Y/N)
      1 2019-03-15  ABC             5362        Y

month in QUERY 从0开始但是没有零月(一月是1)所以你需要+1修正。这样做:

=COUNTA(IFERROR(QUERY(emp1!B2:B, "where month(B)+1=3 and year(B)=2019", 0)))