=query({TOIM;IMTO},"SELECT * where Col1 is not null ORDER by Col11",0)

Where TOIM,IMTO are named ranges.
I want to rewrite the formula with two criteria (OR). In other words like this:

=query({TOIM;IMTO},"SELECT * where Col1 or Col3 is not null ORDER by Col11",0)

But that seems not the correct argument.

1 Answer 1


(following OP's comment)

So, how to say if either Col1 or Col2 is not null ?

" where Col1 is not null and Col2 is not null "

Original answer

Depending on your locale, the formula behaves like

| Formula | Col1 | Col2 |
| ={1,2}  |    1 |    2 |
| ={1;2}  |    1 |      |
|         |    2 |      |

So when you have {TOIM;IMTO} you can either have Col1 and Col2 OR JUST Col1.
In any case, there are no columns like Col3 or Col11.

Please adjust your formula accordingly.

  • So, how to say if either Col1 or Col2 is not null ? Jan 20, 2021 at 13:48
  • Have you tried the given solution? Did it work for you? If not we could try finding out why. If yes, please remember that as per site guidelines when an answer addresses your question, accept it and even upvote it so others can benefit as well. Jan 20, 2021 at 16:07
  • Yes it worked. since my IMTO refers to a range of multiple columns, I can use any Col number that is included in IMTO range Jan 20, 2021 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.