google-sheetsoptimizationsyntaxwhere-clauseclause

google sheet query optimize syntax in where clause with many columns


Hi my gsheets query studying are in progress and I'm looking for optimization of formulas that can be become very long with many datas. In this case I can't find a method to optimize the lenght becaue of the syntax, I think...

I tryied this formula =query({A:G};"select Col1 where "Col"&arrayformula(TEXTJOIN(" OR Col";;SEQUENCE(1;6;2)&"="&""&I2&""))")

Unfortunatly with arrayformula and Text join doesn't work, but copy/paste the result of that formula works properly.

Here's the link to the sheet


Solution

  • You may try:

    =query({A:G};"select Col1 where Col"&join(" OR Col";index(sequence(1;5;2)&"="&I2)))
    

    enter image description here