There are two simple and one advanced comparison methods to apply not equal to in Query in Google Sheets.
You can use any of these methods to filter data, depending on the data type of the column—text, numbers, or dates.
This tutorial explains how to use not equal to in the Google Sheets QUERY function using:
!=<>NOT MATCHES(regular expression–based)
This guide is part of the WHERE Clause in Google Sheets QUERY: Logical Conditions Explained hub, which covers all logical operators, comparisons, and condition-building patterns used in QUERY statements.
Not Equal to in Query Function in Google Sheets
To demonstrate the different not equal to operators, let’s use a sample dataset containing:
- Column A → Text
- Column B → Numbers
- Column C → Dates
This allows us to test how not equal to in Query in Google Sheets behaves across different data types.

1. Using != Operator in Query Function
The != operator is one of the simplest ways to apply a not equal to condition in QUERY.
Formula #1: != in a text column
Filter rows where Column A does not equal the value in cell E1:
=QUERY(A1:C,"SELECT A,B,C WHERE A != '"&E1&"' AND A IS NOT NULL")
Tip: To avoid returning blank rows when using not equal to in Google Sheets QUERY, add AND <column> IS NOT NULL for the column being evaluated (such as A, B, or C).

Hardcoded criterion example:
=QUERY(A1:C,"SELECT A,B,C WHERE A != 'AB10025YX 2' AND A IS NOT NULL")
Formula #2: != in a numeric column
Filter rows where Column B is not equal to the value in E1:
=QUERY(A1:C,"SELECT A,B,C WHERE B != "&E1&" AND A IS NOT NULL")
Hardcoded numeric criterion:
=QUERY(A1:C,"SELECT A,B,C WHERE B != 1 AND A IS NOT NULL")
Formula #3: != in a date column
Using dates in QUERY requires special handling. Dates must be converted to a specific string format.
=QUERY(
A1:C,
"SELECT A,B,C WHERE C != date '"&TEXT(E1,"yyyy-mm-dd")&"' AND A IS NOT NULL"
)
Hardcoded date criterion:
=QUERY(A1:C,"SELECT A,B,C WHERE C != date '2018-01-25' AND A IS NOT NULL")
⚠️ Dates cannot be used directly in QUERY unless they are formatted as strings using yyyy-mm-dd.
2. Using the <> Operator in Query Function
The <> operator works exactly the same as != in the Google Sheets QUERY language.
You can replace != with <> in all the above formulas without changing the logic or results.
3. Using NOT MATCHES for Not Equal to in Google Sheets Query
The MATCHES operator uses regular expressions, making it more powerful and flexible—especially for partial matches.
To apply not equal to, prefix it with the NOT logical operator.
Formula #1: NOT MATCHES in a text column
=QUERY(A1:C,"SELECT A,B,C WHERE NOT A MATCHES '"&E1&"' AND A IS NOT NULL")
Hardcoded text criterion:
=QUERY(A1:C,"SELECT A,B,C WHERE NOT A MATCHES 'AB10025YX 3' AND A IS NOT NULL")
Formula #2: NOT MATCHES in a numeric column
Using a numeric criterion from E1:
=QUERY(A1:C,"SELECT A,B,C WHERE NOT B MATCHES "&E1&" AND A IS NOT NULL")
Hardcoded numeric value:
=QUERY(A1:C,"SELECT A,B,C WHERE NOT B MATCHES 1 AND A IS NOT NULL")
Formula #3: NOT MATCHES in a date column
=QUERY(
A1:C,
"SELECT A,B,C WHERE NOT C MATCHES date '"&TEXT(E1,"yyyy-mm-dd")&"' AND A IS NOT NULL"
)

Hardcoded date:
=QUERY(A1:C,"SELECT A,B,C WHERE NOT C MATCHES date '2018-01-25' AND A IS NOT NULL")
Conclusion: Not Equal to in Query in Google Sheets
To summarize:
- Use
!=or<>for simple not equal to comparisons - Use
NOT MATCHESwhen you need pattern-based or flexible matching - Dates must always be converted to QUERY-compatible strings
- The
NOTlogical operator must precede the column reference, not the value
These methods cover all practical ways to apply not equal to in Query in Google Sheets without resorting to multiple OR conditions.
For a complete understanding of logical conditions in QUERY, see the hub:
WHERE Clause in Google Sheets QUERY: Logical Conditions Explained
For advanced string filtering, refer to:
String Matching in QUERY





















