google-sheetsgoogle-sheets-formulaformula

Query and Importrange function with conditions


I'm trying to retrieve data from a google sheet (source) based on specific values (the location) in a column into another sheet (target location). I have tried the query and importrange formulas but I keep getting error messages.

Link to source sheet: https://docs.google.com/spreadsheets/d/1w3LQwmxWrzPAQIsgDhJycJxKdpQxj0gcxo7blBbD1Xc/edit#gid=0

Link to target sheet: https://docs.google.com/spreadsheets/d/1WXQuB3z6h8pjUVKELNZvMkJaqvR5CCj3J14AJSict0s/edit#gid=0

I'd like this formula to filter values based on col7.

Anyone has an idea how to go about it?

I appreciate your help!

I tried this formula: =(QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1w3LQwmxWrzPAQIsgDhJycJxKdpQxj0gcxo7blBbD1Xc/edit#gid=0","Sample!A2:G"),"select * where Col7 = Midwest"))

And I get this: #VALUE! (Unable to parse query string for Function QUERY parameter 2: NO_COLUMN: Midwest


Solution

  • Two things: try adding simple quotes before and after Midwest, and if that still doesn't work also do an Import range outside of the query to check if your target sheet has the access permissions of the source sheet