FormulaCraft

How to skip header rows in QUERY in Excel and Google Sheets

Topic:QUERY (Google Sheets SQL)

Heads up: Excel and Google Sheets do this differently.

Excel
=FILTER(B2:C10,B2:B10<>"")
Google Sheets
=QUERY(A1:C10,"SELECT A, B, C WHERE A IS NOT NULL",1)

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

Step by step

  1. 1The QUERY signature is =QUERY(data, query_string, headers). The headers argument tells QUERY how many rows at the top of your data range are header rows.
  2. 2Set headers=1 when your range starts at row 1 and row 1 contains column headers — this is the most common case.
  3. 3Set headers=0 when your range starts at a data row (e.g., A2:C10) and has no header row at the top of the range.
  4. 4Set headers=-1 to let QUERY auto-detect — it reads the first row and guesses based on data types. This is less predictable; prefer an explicit 0 or 1.
  5. 5If headers appear as a data row in your output, you have set headers=0 on a range that includes a header row. Change it to 1. If the header row is missing entirely, do the reverse.

Tips

Need the Google Sheets version instead? Open Sheets variant in workspace →

Working on a sheet you inherited? Run the Auditor on the whole file first — it flags every #REF!, #N/A, broken column pattern, and inconsistent formula in seconds, free, no signup.

Frequently asked

What does QUERY output when I set headers=0 and use SELECT *?

QUERY generates automatic column labels based on the column letters or aggregate expressions — e.g., 'A', 'B', 'C' or 'sum Col3'. Use a LABEL clause to override these with readable names.

My QUERY shows the header row as a data row — what went wrong?

Your range includes a header row (like A1:C10) but you passed 0 as the headers argument. Change it to 1 so QUERY knows to treat row 1 as labels, not data.

Can QUERY handle multiple header rows?

Yes. Set headers=2 (or the appropriate count) if your data has a multi-row header block. QUERY will skip that many rows from the top of the range when building its data set.

More on QUERY (Google Sheets SQL)

See all →

Formulas used

Related tasks

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

Last reviewed: