FormulaCraft

Fix the QUERY error error

Excel & Google Sheets
Topic:QUERY (Google Sheets SQL)

What QUERY error means

The QUERY function in Google Sheets accepts a SQL-like string (based on Google's Visualization API query language). A parse error means Sheets could not interpret that string — a keyword is misspelled, column labels are used instead of Col1/Col2 references, or string literals are not delimited correctly. The error message usually specifies the position in the query string where parsing failed.

Common causes

Example fix

Broken
=QUERY(A1:D100,"SELECT A WHERE B = \"East\"",1)
Fixed
=QUERY(A1:D100,"SELECT Col1 WHERE Col2 = 'East'",1)

Changed column letters to positional Col references and replaced double-quoted string literal with single quotes, which is the required syntax inside a QUERY string.

Try it with your data

Edit the grid or formula, then run it through a real spreadsheet engine — no signup.

Sample data — click any cell to edit

Runs server-side · free · no signup

How to fix it

  1. 1Use positional column references: Col1, Col2, Col3 match the first, second, third column of the data range regardless of header names.
  2. 2Wrap text literals in single quotes inside the query string: "SELECT Col1 WHERE Col2 = 'East'".
  3. 3Format date literals correctly: "SELECT Col1 WHERE Col3 > date '2024-01-01'".
  4. 4Set headers correctly: if your range starts with a header row, use 1 as the third argument — =QUERY(A1:D100,"SELECT A,B",1).
  5. 5Build the query string in a cell and reference it with & to debug: =QUERY(A1:D100,"SELECT Col1 WHERE Col2 = '"&E1&"'",1).

Stop hunting errors by hand.

Upload your spreadsheet and the Auditor flags every QUERY error and broken formula at once — or paste this one formula and get the fix explained.

Frequently asked

Can I reference column header names directly in QUERY instead of Col1, Col2?

In most cases no — use positional Col references. Header names work only in specific circumstances and are fragile. Positional references (Col1, Col2) are always reliable.

How do I filter by a cell value in QUERY without hardcoding the text?

Concatenate the cell reference into the query string: =QUERY(A1:D100,"SELECT Col1 WHERE Col2 = '"&B1&"'",1). Be careful with single quotes around the injected value.

What does 'NO_COLUMN: A' mean in a QUERY parse error?

It means QUERY cannot find column A in the data range when you use a column letter reference. Switch to Col1, Col2 notation — or if using headers=1, confirm the header row is included in the range.

More on QUERY (Google Sheets SQL)

See all →

Related formulas

Written and reviewed by FormulaCraft Team. Each formula on this page is run through our verification engine before publishing.

Last reviewed: