Google-sheets – Why doesn’t Query pull up Data when using Where Function to reference a number

google sheetsgoogle-sheets-query

I am relatively new to using the Query function but I would like to understand what I'm doing wrong in the following scenario.

I would like to pull from a table with a Year field in column F and Month field in column G. The query pulls correctly when filtering column E and J but returns nothing once I add either column F or G. This is weird because the source table contains a lot of data for the conditions (verified by filtering the source table). Any idea what could be going wrong?

Screenshot

Best Answer

Get rid of the single quotes around concatenations for numbers; otherwise the QUERY is looking for strings.

Ex:

"... where ... F ="&A3&" and ..."

not

"... where ... F ='"&A3&'" and ..."

Same with "and G ="