How to Use “Not Equal” in Query using Query function
To use "Not Equal" in a query using the Query function in Google Sheets, you can use the "<>" operator. Here's how you can use it:
- Start by preparing your data in Google Sheets.
- In a new cell, type the following formula
=QUERY(range, "SELECT * WHERE ColumnName <> 'Value'")
and replace "range" with the range of data you want to query, "ColumnName" with the name of the column you want to filter, and "Value" with the value that should not be equal to.
Example
Let's say you have the following data:
A B
1 Name Age
2 John 25
3 Jane 30
4 Jack 25
5 Jill 35
Now, you want to filter the data to show only the rows where the Age is not equal to 25.
- In a new cell, type the following formula:
=QUERY(A1:B5, "SELECT * WHERE B <> 25")
- Press Enter.
- The filtered data will be displayed as follows:
Name Age
Jane 30
Jill 35
In this example, we used the QUERY function to filter the data in the range A1:B5 and displayed the rows where the Age (column B) is not equal to 25.
Did you find this useful?