How to Filter Rows in Google Sheets Using QUERY?
Filter Rows with QUERY is a Google Sheets function that filters rows in a specified range where the values in column b match a given value.. Formula Genius generates and validates this formula automatically from a plain-English prompt.
Struggling to filter data in Google Sheets? The QUERY function allows you to easily filter rows based on specific criteria, just like SQL.
The Formula
"Use the QUERY function to filter rows where a column equals a specific value, like SQL WHERE"
=QUERY(A1:C10, "SELECT * WHERE B = 'Value'")
This formula filters rows in a specified range where the values in column B match a given value.
Step-by-Step Breakdown
- Identify the data range you want to query (e.g., A1:C10).
- Use the QUERY function to initiate the query.
- Specify the SELECT statement to choose which columns to return.
- Use the WHERE clause to filter rows based on a specific column value.
Edge Cases & Warnings
- The specified value is not found in the column, resulting in an empty output.
- Case sensitivity issues when filtering text values.
- Using numeric values in quotes may lead to unexpected results.
- Filtering on a column with mixed data types can cause errors.
Examples
"Range A1:C10 with column B containing 'Apple', 'Banana', 'Cherry'."
Rows where column B equals 'Apple'.
"Range A1:C10 with column B containing 'Dog', 'Cat', 'Fish'."
Rows where column B equals 'Cat'.
Frequently Asked Questions
Can I filter by multiple values?
Yes, you can use 'OR' in your WHERE clause to filter by multiple values.
What if my data range changes?
You can adjust the range in the QUERY function to accommodate any changes.
Is the QUERY function case-sensitive?
Yes, the QUERY function is case-sensitive when filtering text values.
Can't find what you need?
Describe any formula in plain English and Formula Genius will generate, explain, and validate it — instantly.