Google Sheets – How to Parse Query String for Function Query with IMPORTRANGE

google sheetsgoogle-sheets-queryimportrange

This is the problem I'm seeing:

Error – Unable to parse query string for function QUERY parameter 2: NO_COLUMND

Error - Unable to parse query string for function QUERY parameter 2: NO_COLUMND

The formula is of the form:

=query(importange("...", "Sheet!A:V"), "select D where V = 1", 1)

I imported data from another sheet, I want this current sheet to display column D when Column V is 1.

Is there a different way rather than my current formula?

Best Answer

When using query with importrange, the imported columns must be referred to as Col1, Col2, Col3, etc, according to their positions in the imported range. So, you should replace

"select D where V = 1" 

with

"select Col4 where Col22 = 1" 

The reason is that imported range is not considered a part of any sheet, so its column names are not like sheet column names.

To find the number of a column without reciting the alphabet, you may want to put =column() in it temporarily.