Search code examples
google-sheetsfiltergoogle-sheets-formulaarray-formulasgoogle-sheets-query

filter one or more tag in google sheet


I have a table that contains data of student. Each student is tagged with one or more tag for note. Each tag is separated by semicolon (or can be anything).

Can I filter student based one or more tag that I apply? The case can be seen below

https://docs.google.com/spreadsheets/d/1JUkdIq6Gvb91f9OxI6i_uaH80weEO7TwqsXvx3vXgX0/edit?usp=sharing

I want to fill the cells in D2:D with tag(s) that i want to use and then the result in E2:E will be populated with student that match the tag(s).


Solution

  • use:

    =ARRAYFORMULA(QUERY({A2:B}, 
     "select Col1 
      where "&TEXTJOIN(" and ", 1, 
     IF(D2:D="",,"Col2 contains '"&D2:D&"'"))))
    

    0