web-dev-qa-db-fra.com

Simplifiez plusieurs instructions OR dans une QUERY à l'aide de IMPORTRANGE

J'essaie d'interroger les valeurs d'une feuille différente en utilisant une plage de la feuille actuelle. Existe-t-il un moyen de simplifier la formule et de se débarrasser de tous les RUP? Comme peut-être utiliser une boucle FOR?

=QUERY(IMPORTRANGE("https://docs.google.com/spreadsheets/d/sample", "Production!A:P"), 
"select Col1, Col6, Col8, Col16 where 
(Col8 contains '"&Tracking!B2&"')  or (Col8 contains '"&Tracking!B3&"')  or
(Col8 contains '"&Tracking!B4&"')  or (Col8 contains '"&Tracking!B5&"')  or 
(Col8 contains '"&Tracking!B6&"')  or (Col8 contains '"&Tracking!B7&"')  or 
(Col8 contains '"&Tracking!B8&"')  or (Col8 contains '"&Tracking!B9&"')  or 
(Col8 contains '"&Tracking!B10&"') or (Col8 contains '"&Tracking!B11&"') or 
(Col8 contains '"&Tracking!B12&"') or (Col8 contains '"&Tracking!B13&"') or 
(Col8 contains '"&Tracking!B14&"') or (Col8 contains '"&Tracking!B15&"') or 
(Col8 contains '"&Tracking!B16&"') or (Col8 contains '"&Tracking!B17&"') or 
(Col8 contains '"&Tracking!B18&"') or (Col8 contains '"&Tracking!B19&"') or 
(Col8 contains '"&Tracking!B20&"') or (Col8 contains '"&Tracking!B21&"') or 
(Col8 contains '"&Tracking!B22&"') or (Col8 contains '"&Tracking!B23&"') or 
(Col8 contains '"&Tracking!B24&"') or (Col8 contains '"&Tracking!B25&"') or 
(Col8 contains '"&Tracking!B26&"') or (Col8 contains '"&Tracking!B27&"') or 
(Col8 contains '"&Tracking!B28&"') or (Col8 contains '"&Tracking!B29&"') or 
(Col8 contains '"&Tracking!B30&"')", 1)
1
Exission Exission

essayez comme ceci:

=FILTER(QUERY(IMPORTRANGE("15YS4mri0m23Z5ai0D3xrGoFw0IYpXNrF-vOpaVYZP_I", "Production!A2:P"),
 "select Col1,Col6,Col8,Col16", 0), 
 REGEXMATCH(IMPORTRANGE("15YS4mri0m23Z5ai0D3xrGoFw0IYpXNrF-vOpaVYZP_I", "Production!H2:H"), 
 ".*"&TEXTJOIN(".*|.*", 1, Tracking!B2:B30)&".*"))

0

0
user0