0
votes

First-time sheets query user so pardon the noob question. I have a Google sheet (document) with multiple tabs. I'm trying to query across the tabs within the containing sheet. I have found that IMPORTRANGE isn't needed since the data is coming from the same source (correct me if I'm wrong please).

The query, grabbing count for specified month and year. emp1 is the tab name source's data:

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

Sample row data (B2 is starting data row, skipping headers B1):

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

1 Answers

1
votes

month in QUERY starts from 0 but there is no zero month (Jan is 1) so you need +1 correction. do it like this:

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

0