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

Google Sheets multiple query matching words and numbers


I need to query a sheet in Google Sheets to find matches for multiple words where values are greater than a specified number.

For example, I want to find all words containing 'garden' or 'gate' and the value is greater than '30' in a sheet that looks something like this:

enter image description here

I have this formula but it's not working:

=QUERY(Sheet1!A:B,"select * where A contains 'garden' OR A contains 'gate' AND B>30 ")

Solution

  • =QUERY(Sheet1!A:B, 
     "where B > 30 
        and (A contains 'garden' 
         or  A contains 'gate')", 0)
    

    0


    =QUERY(Sheet1!A:B, 
     "where A matches '.*garden.*|.*gate.*' 
        and B > 30", 0)