Google-sheets – How to make Query() not break with empty cells

google sheetsgoogle-sheets-query

I'm trying to perform a query through an imported range, but whenever I have an empty cell in the first column, it gives me a cell that is a combination of ALL of the cells that have an empty Col1 at the top of the results that is a long list of all of the other results.

Here's the code:

=QUERY(importrange("", "'Responses'!A2:Z"),"select Col2,Col1 where LOWER(Col2)='" & LOWER($B$1) & "' ORDER BY Col1")

Where $B$1 is the thing I am searching for. This code will give me all of the results but then also fills the top cell with ALL of the data from every empty cell in the imported sheet as well. How can I get it to stop adding that top result? I still want to get the results from cells that have an empty Col1.

Best Answer

Figured it out, adding a header of 0 to the query fixed it.

QUERY(data, query, 0)