What you will fix
A QUERY date filter can fail or return unexpected rows when the date criterion is written like ordinary text or when the source column contains text instead of real dates. In this exercise, the cutoff is September 29, 2026, so only the October 1 row should remain.
Learning objectives
Open the practice workbook
Practice in your own copy
Make your own Google Sheets copy with the same data, formulas, formatting, filter and frozen header. The original remains unchanged.
Sign in to Google. If the original is not publicly shared, download the full workbook and import it into Google Sheets, or paste the example data into your own sheet.
Sample data
| Date | Amount |
|---|---|
| 2026-09-28 | 120 |
| 2026-10-01 | 240 |
A1:B3 is the source table. Column C is intentionally blank; D2 is used for the QUERY formula so the output can spill to the right.
Fix the QUERY date criterion
Step 1: Check A2 and A3 before changing the formula. They should be real Google Sheets date values displayed as 2026-09-28 and 2026-10-01. If an imported value is plain text, convert or re-parse the source date first; changing only the query string does not repair text dates.
Step 2: Select D2 and enter =QUERY(A1:B3,"select A,B where A >= date '2026-09-29'",1), then press Enter. Inside the query string, date is a keyword and the literal date is enclosed in single quotes in yyyy-mm-dd order.
=QUERY(A1:B3,"select A,B where A >= date '2026-09-29'",1)Step 3: Verify the spill from D2:E3. The output header is Date | Amount, and the only data row is 2026-10-01 | 240 because September 28 is before the September 29 cutoff.
Checkpoint
| Output cell | Expected value |
|---|---|
| D2 | Date |
| E2 | Amount |
| D3 | 2026-10-01 |
| E3 | 240 |
These cells are the QUERY spill result. Do not type the four values manually; they must be produced by the formula in D2.
Common mistakes and fixes
If the query reports a parse error, inspect the criterion first. The date literal must appear inside the query string as date '2026-09-29'. Keep the outer query string in double quotes and the date itself in single quotes.
If the formula runs but returns no expected date rows, inspect column A. Values that merely look like dates can still be text after an import. Fix the source type rather than wrapping the QUERY in an error-hiding formula.
If the result cannot expand, clear any content in D2:E3 other than the formula in D2. QUERY returns an array and needs empty cells for its spill range.
Independent practice
Temporarily change A2 to a real date value of 2026-09-30. With the same cutoff, both source rows should then satisfy the condition. Restore A2 to 2026-09-28 when you finish so the checkpoint returns to one matching row.
Key takeaways
- ✓QUERY date criteria use the literal form date 'yyyy-mm-dd'.
- ✓The source date column must contain real date values, not text that only looks like a date.
- ✓The headers argument is 1 because A1:B1 is the header row.
- ✓The formula in D2 spills a two-column result, so its destination cells must be empty.
- ✓With the original sample, the only matching row is 2026-10-01 | 240.
Check your understanding
Answer four questions about the practice sheet.
Next lesson
Continue in the troubleshooting path with the next lesson after you can distinguish QUERY date literals from ordinary text criteria.
Comments
No comments yet. Be the first to join the discussion.