Search code examples
regexgoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Google Sheets Queries and 'not in'


I am trying to piece together a query that does a few things. One, I want it to list out all the names in a column, and two, I only want it to list out the name from that column if it doesn't exist within an array of columns.

=QUERY(QUERY(Breakdown!$A$2:$B), "select Col1 where Col1 != '' and Col2 = 'Warrior' order by Col1 Asc")

I got as far as this, which displays all of the names in the column as I want it to, but when I start adding in 'not in' type parameters, I break it every which way. How do I check that Col1 doesn't exist in the range ='Raid Comp'!A2:Q10?

Here is the spreadsheet: https://docs.google.com/spreadsheets/d/1X0GiOCAAve1CR4A3JG2Ybf-daMvrrhAsZF5V3XEdn4E/edit?usp=sharing

What I am tryin to do is once a name is entered within the colored areas, if name entered exists in the list below the colored area, the name is removed from the list.

Example:

enter image description here enter image description here


Solution

  • try regex in query:

    =QUERY({Breakdown!$A$2:$B}, 
     "select Col1 
      where Col2 = 'Warrior' 
        and not Col1 matches '"&TEXTJOIN("|", 1, 'Raid Comp'!A2:Q10)&"'  
      order by Col1 asc")