Search code examples
if-statementgoogle-sheetsgoogle-sheets-formulaarray-formulastextjoin

Group data by columns and show all rows that meet criteria


This is my data:

ID  DATA1  DATA2  DATA3  DATA4
1   yes    yes           yes
2          yes    yes
3   yes                  yes

What I like to get:

DATA1
- ID1
- ID3
DATA2
- ID1
- ID2
DATA3
- ID2
DATA4
- ID1
- ID3

Anyone knows what query or formula I can use for this?


Solution

  • try:

    =ARRAYFORMULA(TRANSPOSE(SPLIT(TEXTJOIN("♦", 1, TRANSPOSE({B1:E1;
     IF(B2:E="yes", "- "&A1&A2:A, )})), "♦")))
    

    0