Search code examples
google-sheetsgoogle-sheets-formulagoogle-sheets-queryimportrange

IMPORTRANGE with condition


Using Google Sheets I want, within the same document, to import data from one sheet to another using IMPORTRANGE with conditions.

I have tried unsuccessfully:

=IF(IMPORTRANGE("https:URL","Inc Database!B2:B300")="permanent",IMPORTRANGE("htps://URL","Inc Database!A2:A300"),"")

and

=QUERY(IMPORTRANGE("https:/URL", "Inc Database!A2:A300"),"SELECT Col1 WHERE Col1 <> 'permanent'")

and

=FILTER(IMPORTRANGE("URL","Inc Database!A1:A250"),IMPORTRANGE("URL","Inc Database!B1:B250"="venture permanent"))

I want the function to say: Import any values from range A that meet criterion "permanent" in range B.

    A    |  B    
_________|_________
 Name    |type 
---------|-------
 Henry   |Permanent
 William |Intern
 John    |Permanent  

Solution

  • I have put a few examples in the following spreadsheet:

    e.g. =QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1LX7JfbGvgBTfmXsYZz0u5J7K0O6oHJSnBowKQJGa9lY/edit#gid=0", "Inc Database!A2:B300"),"SELECT Col1 WHERE not(Col2 = 'Permanent') ")