Google-sheets – Show each n-th column, hide others in Google Sheets

formulasgoogle sheetsgoogle-apps-script

I have several big tables, and I know that each 4th column is interesting for me, i.e B,F,J,N, etc (The total number of columns is different in different documents)

Is there an easy way (some sort of a script) I can use to hide all other columns in few clicks?

Best Answer

  • for columns A, D, H, L, etc.

    ={Sheet1!A1:A, FILTER(INDIRECT("Sheet1!A1:"&ADDRESS(ROWS(Sheet1!A:A), 
     COLUMNS(Sheet1!1:1), 4)), NOT(MOD(COLUMN(Sheet1!1:1), 4)))}

  • for columns D, H, L, etc.

    =FILTER(INDIRECT("Sheet1!A1:"&ADDRESS(ROWS(Sheet1!A:A), 
     COLUMNS(Sheet1!1:1), 4)), NOT(MOD(COLUMN(Sheet1!1:1), 4)))