I need some help here. So I need a function which imports selected columns from a different sheet out of which one of them contains a specified word but allows you to filter/ignore based on specified words

And here's the example sheet: https://docs.google.com/spreadsheets/d/1brWG_lbvqQUDT5x9ZGmxFKYUu6ByQ56SPi9Y9C21WBQ/edit#gid=1683245951

And this is the QUERY Function: =query(Sheet1!A:F, "SELECT A, B, C, D, E, F where (E contains 'Apple')")

Thank you for any help.

  • Sorry I don't see any apple in your sheet May 26, 2020 at 22:21
  • 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. May 26, 2020 at 22:32
  • I know but my question is not answered the way i wanted it yet, i have added a new comment to the person's reply.
    – Cheryl
    May 26, 2020 at 23:20

1 Answer 1


You would just use and

The only column containing a different variable is column B. So you could use

=query(Sheet1!A:F, "SELECT A, B, C, D, E, F where E contains 'Apple' and B contains 'had'")

you do not need the parentheses around E contains 'Apple'

  • 1
    Also, since you are selecting the whole row, you could just say "select * where E contains 'Apple' and B contains 'had'" May 26, 2020 at 22:29
  • All of your suggestions, answer and comment stand correct. :) May 26, 2020 at 22:32
  • 1
    "<>" is equivalent to does not contain or "is not" May 27, 2020 at 0:12
  • 2
    yes, you would say, =query(Sheet1!A:F, "SELECT * where E contains 'Apple' and B <> 'has' and B <> 'had'") May 27, 2020 at 0:25
  • 1
    But since your column B only contains those two words, your result will be an empty query. You can test the formula by changing one of the words to something different from has or had May 27, 2020 at 0:27

Your Answer

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

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