Google Sheets – Query Select All Values of Specific Month

formulasgoogle sheetsgoogle-sheets-datesgoogle-sheets-query

A have a table where Column A has dates. I want to get all values of a specific month

I have the following query for May for example

=query(Database!A1:AD,"Select A,E,F,U,V,W,X,AB,AC where Month(A) = 5",1)

but it does not work. Where I am wrong?
Query

=query(Database!A1:AD,"Select A,E,F,U,V,W,X,AB,AC where A > date '2019-05-01' and A < date '2019-05-31'",1)

works fine but I have a separate drop-down list with the months' number 01 02 03 …. and I want the query to change when I change the month number. But even when I put the month number directly into query it shows nothing. No any mistake – just no rows with values, only header

Best Answer

  • months in QUERY starts from 0 so you need to fix it with +1

    =QUERY(Database!A1:AD, "select A,E,F,U,V,W,X,AB,AC where month(A)+1 = 5", 1)