Home > database >  Google Sheets using QUERY IMPORTRANGE from another sheet but query where references current sheets
Google Sheets using QUERY IMPORTRANGE from another sheet but query where references current sheets

Time:01-11

I am trying to get the Query to pull from the Outside Sheets range but have the Where look at the number in a cell on a tab within the current sheets. I have reviewed other questions and none of those solutins ahs worked for this.

I want this so that I dont have to change the number in each query for every sheets created. We want use a template with all the formulas and then copy and adjust just one cell and that way the correct data is being pulled for each instance.

Current: =QUERY({IMPORTRANGE("URL", "JAN!A2:T"),"SELECT Col11, Col12, Col13, Col14, Col15, Col16 WHERE Col1 = 804793 ,0)"

Trying but getting a parrsing error: =QUERY({IMPORTRANGE("URL", "JAN!A2:T"),"SELECT Col11, Col12, Col13, Col14, Col15, Col16 WHERE Col1 = "&Overview!B2,0)

We have almost 300 of these to creat and we would have to change the number in each QUERY for each monthly tab if we can't get it to just reference the number in the current sheets overview tab.

Open to using App Scripts if it makes it easier just not great with the language.

CodePudding user response:

try:

=QUERY({IMPORTRANGE("URL"; "JAN!A2:T")};
 "select Col11,Col12,Col13,Col14,Col15,Col16 
  where Col1 = "&Overview!B2*1; 0)

or:

=QUERY({IMPORTRANGE("URL"; "JAN!A2:T")};
 "selece Col11,Col12,Col13,Col14,Col15,Col16 
  where Col1 = '"&Overview!B2&"'"; 0)
  • Related