Search code examples
google-sheetsgoogle-sheets-formulatransposegoogle-sheets-querygoogle-query-language

Google Sheets query: filter columns selecting rows with specific condition: "select * WHERE "row5" = "ColContas" OR "row5" = "ColNum""


I've used query a lot of times to filter rows, like select * WHERE R = "ColContas" in this case filtering rows and selecting only the ones where R has the "ColContas" tag.

This time I need to filter columns, I just want to select the columns where in line 5 there is "ColContas" or "ColNum". That is to say, this:

enter image description here

Should turn into this:

enter image description here

Should be something like select * WHERE “row5” = “ColContas” OR “row5” = “ColNum”

How could I do that?


Solution

  • try:

    =TRANSPOSE(QUERY(TRANSPOSE(A5:G); "where Col1 matches 'ColContas|ColNum'"; 1))
    

    enter image description here