How to use QUERY with multiple conditions in Google Sheets
Google Sheets formula
=QUERY(A1:F13,"select B, C, D, F where (C = 'East' or C = 'North') and F >= 1500",1)Join tests with and and or, and bracket the or part: =QUERY(A1:F13,"select B, C, D, F where (C = 'East' or C = 'North') and F >= 1500",1).
- Result on the example
- a 5-row list that spills from H1 in
H1 - Excel
- See below
See it work
The formula is already in H1. Change any input and the result updates, or edit the formula to experiment.
How it works
and needs both tests to pass and or needs either. Like most languages, QUERY does and before or, so the brackets are what make this "East or North, and at least 1,500" rather than "East, or North with at least 1,500".
=QUERY(A1:F13,"select B, C, D, F where (C = 'East' or C = 'North') and F >= 1500",1)Result{5 rows × 4 cols} "Rep", "Region", "Product", "Revenue", …
A1:F1313 rows × 6 cols: "Date", "Rep", "Region", "Product", …A range: 13 rows × 6 columns.
QUERY(A1:F13,"select B, C, D, F where (C = 'East' or C = 'North') and F >= 1500",1){5 rows × 4 cols} "Rep", "Region", "Product", "Revenue", …QUERY: Runs a SQL-like query: select, where, group by, order by, limit, label.- data
A1:F1313 rows × 6 cols: "Date", "Rep", "Region", "Product", … - query
"select B, C, D, F where (C = 'East' or C = 'North') and F >= 1500" - headers
1
- data
In Excel
=FILTER(A2:F13,((C2:C13="East")+(C2:C13="North"))*(F2:F13>=1500)).Other ways to do it
Each one was run on the same example sheet.
| Formula | Result | When to use it |
|---|---|---|
| =QUERY(A1:F13,"select B, C, D, F where C = 'East' or C = 'North' and F >= 1500",1) | spills 8 × 4Different result | Without brackets, the revenue test only applies to North. Includes every East order, even those under 1,500. |
| =QUERY(A1:F13,"select B, C, D, F where C matches 'East|North' and F >= 1500",1) | spills 5 × 4 | matches with | is a shorter way to say "either value". |
Common mistakes
- Mixing and with or without brackets gives a different result than you meant, with no error to warn you.
- Each test needs its own column name:
where C = 'East' or 'North'isn't valid.
Try it yourself
Same data, empty answer cell. Your formula is graded instantly, then re-checked on changed data, so a typed-in number won't pass.
Use QUERY with multiple conditions
H1, use QUERY to return Rep, Region, Product and Revenue for orders from East or North with revenue of at least 1500.Questions
How do I exclude a value?
Use != or not: where C != 'West' or where not C = 'West'.
How do I test values typed in cells?
Join each one in: "where C = '"&I1&"' and F >= "&I2.
Checked by running on 2026-10-30: every formula and result on this page was calculated by the Spreadsheet Practice formula engine.