6

I'm trying to filter out dates greater than today. I looked up the syntax but the date-part does not work; I'm still getting dates > today in the results. Could someone help me out with this?! Thank you! Here' the query:

=iferror(sort(if(isblank(Sheet1!B1),
query(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1TWDHeriSlgHYKYmfwNxVm_4apbuavrX94itSpEykBI4/edit#gid=1635810036","responses!b2:l"),"select *"),query(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1TWDHeriSlgHYKYmfwNxVm_4apbuavrX94itSpEykBI4/edit#gid=1635810036","responses!b2:l"),
"select * WHERE Col1 = '"&Sheet1!$B$1&"'AND Col2 > date'"&TEXT(today(),"dd-mm-yyyy")&"'")),2,true),"no results")
Rubén
  • 34,714
  • 9
  • 70
  • 166

3 Answers3

7

You might want to try replacing part of your formula with:

date '"&text(today(),"yyyy-mm-dd")&"'

possibly reversing the angled bracket, and reading about minimal complete and verifiable example.

Ref

pnuts
  • 58,317
  • 11
  • 87
  • 139
4

The following formula should work, issue is in the space between > and date and how you placed the " and '

=iferror(sort(if(isblank(Sheet1!B1),
query(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1TWDHeriSlgHYKYmfwNxVm_4apbuavrX94itSpEykBI4/edit#gid=1635810036","responses!b2:l"),"select *"),query(IMPORTRANGE("https://docs.google.com/spreadsheets/d/1TWDHeriSlgHYKYmfwNxVm_4apbuavrX94itSpEykBI4/edit#gid=1635810036","responses!b2:l"),
"select * WHERE Col1 = '"&Sheet1!$B$1&"' AND Col2 > date '"&TEXT(today(),"dd-mm-yyyy")&"'")),2,true),"no results")
helcode
  • 1,859
  • 1
  • 13
  • 32
1
where Col5 > date' "&TEXT(today(),"yyyy-mm-dd")&" '

That is what I used.

fcdt
  • 2,371
  • 5
  • 14
  • 26
Phuong Ho
  • 11
  • 1