🗂️ Google Sheets query examples

Query Where Examples in Google Sheets

Use QUERY to filter rows with WHERE conditions. This page gives a clear pattern, five practical examples and common mistakes to avoid.

Updated 2026-06-125 practical examplesCopy-ready formulas

💡 Ideas for You

Learning resources for Google Sheets formulas, trackers and reports.

4 useful links

Some links in this section may be affiliate links. Choose only what is useful for your own work.

Syntax or pattern

Use QUERY to filter rows with WHERE conditions.

=QUERY(data, "select A, B where C > 100", 1)
✍️

5 practical examples

1

Build a clean table with QUERY WHERE

Return only the columns and rows needed for a report.

=QUERY(A1:E, "select A, B, E where E is not null", 1)

Adjust the ranges, criteria and sheet names to match your workbook.

2

Summarize by category

Create a category summary without a pivot table.

=QUERY(A1:E, "select B, sum(E) group by B", 1)

Adjust the ranges, criteria and sheet names to match your workbook.

3

Show top records

Return the top rows for a quick dashboard.

=QUERY(A1:E, "select A, E order by E desc limit 10", 1)

Adjust the ranges, criteria and sheet names to match your workbook.

4

Filter by text

Show records that match a selected status.

=QUERY(A1:E, "select A, B where C = 'Open'", 1)

Adjust the ranges, criteria and sheet names to match your workbook.

5

Group by month

Summarize monthly data after preparing date labels.

=QUERY({A2:A, E2:E}, "select Col1, sum(Col2) group by Col1", 0)

Adjust the ranges, criteria and sheet names to match your workbook.

Common mistakes to avoid

  • Using column letters instead of Col1 notation with imported array data.
  • Forgetting quotes inside QUERY strings.
  • Grouping without aggregating non-grouped columns.

FAQ

What is this Google Sheets page for?

This page gives copy-ready examples for query where examples so you can understand the pattern and adapt it to real spreadsheet work.

Can I copy these formulas directly?

Yes. Use the copy buttons, then adjust sheet names, ranges, criteria and column references for your own file.

Why does my formula return an error?

The most common causes are mismatched ranges, missing quotes around text criteria, blank source data, or references that do not match your sheet layout.