Use QUERY in Google Sheets to Filter and Analyze Data

Insert a QUERY formula to pull, filter, and sort ranges using SQL-like statements (e.g., SELECT, WHERE). Results update automatically when source data changes.

What the video covers

Show how to write a basic QUERY formula: pick the output cell, supply the range, write the SQL-style query string, and run it so results populate and update automatically.

Watch the video on YouTube

Step-by-step instructions

  1. Pick an output cell
    Click the cell where you want the filtered results to appear.
  2. Start the QUERY formula
    Type =QUERY( to begin the formula.
  3. Select your data range
    Highlight the table or range containing the data you want to analyze and add a comma after the range in the formula.
  4. Write the SQL-style query string
    Type the query inside quotation marks, for example: "SELECT A, B WHERE C 100" — then add a closing parenthesis.
  5. Run the query
    Press Enter. The sheet populates with rows and columns that match your query and will update automatically when source data changes.
  6. Adjust as needed
    Edit the query string to change selected columns, add ORDER BY, GROUP BY, or modify WHERE conditions to refine results.

Watch the video

Video thumbnail for Use QUERY in Google Sheets to Filter and Analyze Data Play tutorial

Watch on YouTube

Why it matters

QUERY lets you extract just the rows and columns you need using familiar SQL-like syntax, keeping your analysis dynamic as the source data changes.

Check your result

The chosen cell fills with the filtered table. Changing the source rows that meet the query immediately updates the results.

Troubleshooting

If the formula returns an error or no data: ensure the range covers the columns referenced in your query; use correct column identifiers (A, B, C) or the appropriate query column names; check quotations, commas, and parentheses; include header rows in the range if your query references column names.