Search code examples
google-sheetsnullgoogle-query-language

Query google sheet => how does "null" work in this formula?


I have 1 mastersheet in which I want to add all the data from 2 other sheets if column J (Col10) is empty.

This formula does not work:

=query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where Col10 is null", 1)

In this case I only get the results from the first sheet. (BXL | hair salon)

The opposite, where I do the following (and add all the data where column j is not null) does work (but it's ofc not what I need):

=query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where Col10 is not null", 1)

How is this possible? Is there something about null i do not understand?


Solution

  • Ok, I found the answer.

    Not null also takes the cells of the completely empty rows. When I scrolled way (way) down, I could see the results.

    I fixed it for now like this:

    =query({'BXL | hair salon | Export'!1:1000; 'BXL | Bike shop | export'!1:1000}, "select * where (Col10 is NULL and Col2 is not null)", 1)

    As every column B has data when it's a not empty row, this filters out the entirely empty rows.