How can I use “not equal” in a Google Sheets query? 2

How can I use “not equal” in a Google Sheets query?

A “not equal” operator can be used in a Google Sheets query to filter data and display only the values that do not match a specified criteria. This operator, denoted as “”, allows users to compare values and retrieve results that are different from the specified criteria. It can be used in conjunction with other operators to create more complex queries and refine the data displayed in a Google Sheets spreadsheet. By using the “not equal” operator, users can easily filter and analyze their data to get more specific and accurate results.

Google Sheets Query: Use “Not Equal” in Query


You can use the following methods to use a “not equal” operator in a Google Sheets query:

Method 1: Not Equal to One Specific Value

=query(A1:C11, "select * where A != 'Value1'")

Method 2: Not Equal to One of Several Values

=query(A1:C11, "select * where A != 'Value1' and B != 'Value2'")

Note that != is the “not equal” operator in Google Sheets.

The following examples show how to use each formula in practice with the following dataset in Google Sheets:

Example 1: Query Rows Not Equal to One Specific Value

We can use the following formula to select all rows where the Position column is not equal to ‘Guard’:

=query(A1:C11, "select * where A != 'Guard'")

The following screenshot shows how to use this formula in practice:

Google Sheets query not equal to

Notice that only the rows where the Position is not equal to ‘Guard’ are returned.

Example 2: Query Rows Not Equal to One of Several Values

We can use the following formula to select all rows where the Position column is not equal to ‘Guard’ and the Team column is not equal to ‘Warriors’:

=query(A1:C11, "select * where A != 'Guard' and B != 'Warriors'")

Notice that only the rows where the Position is not equal to ‘Guard’ and the Team is not equal to ‘Warriors’ are returned.

Note: The query() function is case-sensitive. This means that if you type A != ‘guard’ then the query will still return rows where the Position is Guard because the two values don’t have the same case.

Additional Resources

The following tutorials explain how to perform other common tasks with Google Sheets queries:

Google Sheets Query: How to Use Group By

Cite this article

stats writer (2024). How can I use “not equal” in a Google Sheets query?. PSYCHOLOGICAL SCALES. Retrieved from https://scales.arabpsychology.com/stats/how-can-i-use-not-equal-in-a-google-sheets-query/

stats writer. "How can I use “not equal” in a Google Sheets query?." PSYCHOLOGICAL SCALES, 30 Jun. 2024, https://scales.arabpsychology.com/stats/how-can-i-use-not-equal-in-a-google-sheets-query/.

stats writer. "How can I use “not equal” in a Google Sheets query?." PSYCHOLOGICAL SCALES, 2024. https://scales.arabpsychology.com/stats/how-can-i-use-not-equal-in-a-google-sheets-query/.

stats writer (2024) 'How can I use “not equal” in a Google Sheets query?', PSYCHOLOGICAL SCALES. Available at: https://scales.arabpsychology.com/stats/how-can-i-use-not-equal-in-a-google-sheets-query/.

[1] stats writer, "How can I use “not equal” in a Google Sheets query?," PSYCHOLOGICAL SCALES, vol. X, no. Y, ص Z-Z, June, 2024.

stats writer. How can I use “not equal” in a Google Sheets query?. PSYCHOLOGICAL SCALES. 2024;vol(issue):pages.

Download Post (.PDF)
Slide Up
x
PDF
Scroll to Top