'IMPORTRANGE with filter

I want to do an IMPORTRANGE with a filter, where it only pulls through data if a cell in column C contains a term that is listed in another column G.

I need columns A:E to import from another sheet, if the column C data appears in column G somewhere, on the current sheet.

This is what I have done which isn't correct but can't work it out:

=QUERY(IMPORTRANGE("URL","Sheet1!A2:E"),"select * where $C='$G:$G'")

Please see the image below:

enter image description here



Solution 1:[1]

use:

=QUERY(IMPORTRANGE("URL", "Sheet1!A2:E"),
 "where Col3 matches '"&TEXTJOIN("|", 1, G:G)&"'")

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 player0