How to Ignore Blank Cells in Query using Query function
To ignore blank cells in a query using the Query function in Google Sheets, you can use the following steps:
- Open your Google Sheet with the data you want to filter.
- Determine the range of cells you want to query. For example, if you have data in cells A1 to D10, your range would be A1:D10.
- Use the
QUERY()
function and include aWHERE
clause with a condition to ignore blank cells. For example, if you want to ignore blank cells in column B, you can use the following formula:
=QUERY(A1:D10, "SELECT * WHERE B is not null", 1)
This formula will return all rows where the value in column B is not empty.
Example
Let's assume you have the following data in cells A1 to D5:
A B C D
-------------------------
Name Age City Score
Alice 25 London 85
Bob Paris 90
Charlie 30 Madrid 88
David 35 Berlin 92
To ignore the blank cells in column B (Age), you can use the following formula:
=QUERY(A1:D5, "SELECT * WHERE B is not null", 1)
The result will be:
Name Age City Score
-----------------------------
Alice 25 London 85
Charlie 30 Madrid 88
David 35 Berlin 92
As you can see, the row with Bob is not included in the result since the Age cell (B2) is empty.
Did you find this useful?