1
votes

I have a Query formula in Google Sheets where I'm trying to set a condition that shows rows where Col1 > (Col2 +15 days). I'm not sure how to do the math on the +15 days in the Query formula.

I tried the following code:

=Query(A:B,"Select * where Col1>Col2+15")

I want it to show me where Column 1 is greater than the Col2 date + 15 days

3

3 Answers

2
votes

Or you can use Datediff within your query:

=Query(A:B,"Select * where A is not null and datediff(A,B)>15")

See

0
votes

I would add into the query {A:B,B:B+15}. This will add a third column into your selection with Col2+15 days. Then from there, you can select the first two columns, but still ask whether Col1 is greater than Col3. =arrayformula(query({A:B,B:B+15},"select Col1,Col2 where Col1 > Col3"))

0
votes
=ARRAYFORMULA(TO_DATE(QUERY(VALUE(A1:B), 
 "select * where Col1 > Col2+15", 0)))