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

What's the proper syntax to query a string in google sheets?


When I use the Query function like this using a number, it returns the correct results:

=QUERY(Sheet2!A1:B12,"select B where A matches '1200'", 0)

But, when I try to match a string, the result is always an empty output:

=QUERY(Sheet2!A1:B12,"select B where A matches 'qwerty'", 0)

This seems ultra-simple, but I can't seem to find an answer anywhere.. What exactly is the correct syntax to match the string? I've included an example of my problem here: sheets_query


Solution

  • I suggest you format ColumnA of Sheet2 as Plain text.