SFSpreadsheet Fixes LabFast fixes for Sheets and Excel

Google Sheets / 7 min read

Google Sheets QUERY Function Examples

Learn practical QUERY formulas for selecting columns, filtering rows, sorting results, and summarizing spreadsheet data.

QUERY lets you ask spreadsheet data questions with a SQL-like formula. Start with select, where, and order by before trying grouped summaries.

Check this first

  • Use column letters like A, B, and C inside the query string.
  • Wrap text criteria in single quotes inside the query.
  • Set the header count correctly at the end of the formula.
  • Start with a simple select query before adding filters or grouping.

Working examples

Select specific columns

=QUERY(A1:D, "select A, C, D", 1)

Filter and sort open rows

=QUERY(A1:D, "select A, B, C where D = 'Open' order by C desc", 1)

Why QUERY is popular

QUERY can replace several helper formulas when you need a live report from raw spreadsheet data. It can select columns, filter rows, sort results, and create simple grouped summaries from one formula.

That makes it powerful, but also easier to break if the query string has quoting or column-reference mistakes.

Start with a readable query

The fastest learning path is to build the query in small steps. First return the columns you want. Then add a where clause. Then add order by or group by only after the base result is correct.

  • Use select to choose columns.
  • Use where to filter rows.
  • Use order by to sort results.
  • Use group by only after the detail query works.

Text criteria and quotes

Text criteria inside a QUERY string normally need single quotes. If you use double quotes for both the formula string and the text value, Google Sheets cannot parse the formula cleanly.

This site uses Google Analytics to understand aggregate traffic and improve the pages. You can allow or decline analytics cookies.