A safe starting pattern
For a normal range with one header row, start simple:
The third argument, 1, tells Google Sheets™ there is one header row. If your selected range starts at row 2 and has no header, use 0 instead.
Cause 1 - The header-row argument is wrong
If QUERY guesses headers incorrectly, it can drop your first data row or treat a header as data.
Fix: always set the third argument instead of letting Sheets guess.
Cause 2 - You are using the wrong column reference style
Normal ranges use letters like A, B, and C. Array literals and IMPORTRANGE outputs often need Col1, Col2, and Col3.
Fix: if the data source is wrapped in another function, try Col1 style references.
Cause 3 - You used header names instead of query columns
QUERY does not usually let you write select Revenue just because the header says Revenue. Use the column letter or Col number.
Fix: map each visible header to its actual query column before changing the formula.
Cause 4 - Text criteria are not quoted correctly
Text inside the query string needs single quotes. The formula string itself uses double quotes, so text criteria go inside single quotes.
If the criterion lives in a cell, concatenate it carefully:
Cause 5 - Date criteria are not written in QUERY format
QUERY dates need the date keyword and yyyy-mm-dd format.
If the date is in a cell, use TEXT:
Cause 6 - A text value contains an apostrophe
Names like O'Brien or product labels with apostrophes can break a query string because the apostrophe closes the text criterion.
Fix: sanitize the criterion before concatenating it:
If that becomes hard to maintain, use a helper column to normalize the criterion or switch to FILTER for the specific case.
Cause 7 - A column mixes numbers and text
QUERY infers one dominant data type per column. If an amount column mixes real numbers with text values like "15000" or "$15,000", some rows can become null or disappear from numeric filters.
Find it:
Fix: clean the column into a helper column first, then point QUERY at the cleaned range.
Cause 8 - IMPORTRANGE is not connected yet
If QUERY(IMPORTRANGE(...)) returns an error, test IMPORTRANGE alone first. Google Sheets often needs you to allow access before the query can run.
Once the imported data appears, wrap it with QUERY. Debugging both at once makes the error harder to read.
Cause 9 - Blank rows or repeated headers are inside the data
Exported reports often contain repeated header rows, subtotals, and blank sections. QUERY reads them as data unless your query filters them out.
The best fix is a flat source table: one header row, one record per row, no merged cells, and no subtotal rows inside the calculation range.
Quick diagnostic checklist
Write QUERY formulas against your real sheet
SheetBrain reads the active Google Sheet structure, then helps generate, explain, and debug formulas using your actual headers and ranges. The Check tab also scans for mixed data types and visible formula errors that often break QUERY results.
Install free on Google WorkspaceTL;DR
- Set the header argument. Use
1for one header row and0for no header. - Use the right column style. Normal ranges use
A/B; imported arrays often useCol1/Col2. - Do not use visible header labels as query fields. Use column references unless your formula explicitly creates those labels.
- Quote text criteria. Use
where B = 'Paid', notwhere B = Paid. - Format dates as QUERY dates. Use
date 'yyyy-mm-dd'. - Clean mixed-type columns first. QUERY can skip or null rows when a column mixes numbers and text.
- Use SheetBrain when you want formula help grounded in your real sheet headers, ranges, and data types.