Query formula returns only one row of data on Google Sheets when comparing dates

Viewed 90

I'm trying to get a Query formula to filter rows that have a past date in column B. Here's the formula:

=QUERY(users!A2:BB,"SELECT B, C, D, G, AI WHERE AM < "&DEVS!A2&"",1)

AM contains the row's date, and DEVS!A2 contains Today's date using the TODAY() formula.

I get one result in the row I have the Query on, but it doesn't automatically reutrn the other results.

The scenario is recreated in this sample sheet:

https://docs.google.com/spreadsheets/d/1_GXWOHW1nKzjRDvAJGnq8cpD_ewZIvzCTSH2lxJ8VhA/edit?usp=sharing

2 Answers

I was able to get it to work by using:

=QUERY(users!A2:BB,"SELECT B, C, D, G, AI WHERE AM < now() ",1)

use:

=QUERY(A2:B, "select A where B < date '"&TEXT(G2, "e-m-d")&"'", )

enter image description here

Related