Search code examples
dategoogle-sheetsgoogle-sheets-formulamatchgoogle-query-language

How to list data from another sheet depending on the date


I’m trying to create a sheet that lists entries depending on the month. As seen in the code below, I want it to look for which month is selected on the Summary sheet (in cell H2) and then display the correct data from the Data sheet according to the correct month (months are listed in column A)

=QUERY(Data!A2:$E,"where month(A)+1=Summary!H2:$H AND E = 'Expense'", 1)

I’m not sure if this is possible with query as I’m pretty sure it needs to be a numerical value after the = in the month condition


Solution

  • try:

    =QUERY(Data!A2:E, "where month(A)+1="&MONTH(Summary!H2)&" and E = 'Expense'", 0)
    

    where Summary!H2 is a numeric number from 1 to 12