How to use a range of cells in a WHERE clause QUERY in Google Spreadsheets

Viewed 32

enter image description here

If I want to select all data given a Date value (H1) how can I use a range in the WHERE clause?

1 Answers

you cant. if you want to go this route you need to flip it query it and again flip it:

={A1:A, TRANSPOSE(QUERY(TRANSPOSE(B:F), "where Col1 = "&H1))}

hard to tell what cell formating you use so if above wont work try:

={A1:A, TRANSPOSE(QUERY(TRANSPOSE(B:F), "where Col1 = '"&H1&"'"))}

or:

={A1:A, TRANSPOSE(QUERY(TRANSPOSE(B:F), 
 "where Col1 date = '"&TEXT(H1, "yyyy-mm-dd")&"'"))}

but its easier with FILTER:

={A1:A, FILTER(B:F, B1:F1=H1)}
Related