0

I have a column with 3 options:

Primary
Secondary
[empty cell]

I am currently using this formula to filter all rows that contain "Primary" from one spreadsheet to another and it's working well.

=query(importrange("https://URL", "CAT!A1:R"), "select * where Col2 = 'Primary'")

I now need to filter rows that are also empty. I can't seem to figure out how to add the second criteria.

Or, what may make more sense, I need to filter for everything but "Secondary".

1
  • 1
    Generally speaking, != or <> are usually used for "not equals". Did you try that?
    – ale
    Nov 29, 2016 at 16:26

1 Answer 1

1

OP presumably did try what was recommended in a Comment, found that satisfactory, and never bothered to report back. For the sake of an answer:

=query(importrange(" k e y ","CAT!A:R"),"select * where Col2 <> 'Secondary'")

k e y need not be the entire URL. Just the part that looks like this is sufficient:

1MiNSa3xN5sjAo43zt-oU4gzjaRfYwFQ-lbGWkZi5z64

No need to specify the first row of the source when whole columns are involved.
Since acquired with IMPORTRANGE columns can't be referenced by just letters (ie must be Col2 (case sensitive) rather than B).
The exclusion term (Secondary) is case sensitive.

Since acquiring all rows blank in ColumnB of the source it may be a good idea to add further provision, such as specifying a sort order, to avoid all (if any) empty rows rising to the top.

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.