0

Hi everyone,

I want to get all the rows where A=1, A=2. The query is very simple but I'm not sure why there is no output. I guess is the problem of the format for column A but I'm not sure what should I change in my formula so that the formula can work. Appreciate any help or advice!

1
  • You could also try =QUERY(A3:C,"Where A matches '1|2'",0), or QUERY(A3:C,"Where A matches '[12]'",0) Commented May 23, 2022 at 9:22

3 Answers 3

3

A can't be both: 2 and 1. Instead try

=query(A3:C, "Where A = 2 or A = 1", 0)
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks, I didn't notice I make the mistake there. Thanks!
2

It should have been OR not AND - it's impossible for any row in a particular column to have two values simultaneously:

=query(A3:C,"select * where A=1 or A=2",0)

enter image description here

Comments

2

QUERY() is good choice. You can also use FILTER() function like-

=FILTER(A3:C,A3:A>=1,A3:A<=2)

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.