Excel & Google Sheets Function
QUERY (Google Sheets) function in Excel (with interactive examples)
QUERY runs SQL-like SELECT, WHERE, GROUP BY, and ORDER BY queries directly inside a Google Sheets formula.
Syntax
=QUERY(data, query, [headers])Live Interactive Exercise — Try it nowNo login required
Interactive practice grid (QUERY (GOOGLE SHEETS) reference)
Try our live spreadsheet engine: total Q1 sales in cell B5 using =SUM(B2:B4).
B5fx
| A | B | |
|---|---|---|
| 1 | Month | Sales |
| 2 | Jan | $1,100.00 |
| 3 | Feb | $1,350.00 |
| 4 | Mar | $1,550.00 |
| 5 | Total | type here |
Insert:
Arguments explained
| data | Required | Range to query (e.g. A1:E100). |
| query | Required | Google Visualization query string, e.g. "SELECT A, SUM(C) WHERE B = 'North' GROUP BY A". |
| headers | Optional | Number of header rows at the top of data (usually 1). |
Common errors & fixes
#VALUE! parse error: Column letters inside the query string are case-sensitive (use uppercase A, B, C) and text literals use single quotes.
Excel vs Google Sheets
Exclusive to Google Sheets — one of the best bridges from spreadsheets into real SQL.
Practise QUERY (Google Sheets) in a full 4-minute lesson
Every lesson is free to study — build real speed with instant feedback.
Free 1-Page Excel, Google Sheets & SQL Interview Cheat Sheet
The 25 formulas, keyboard shortcuts, and SQL patterns tested most in analyst interviews — emailed instantly, zero spam.