Search code examples
dategoogle-sheetsgoogle-sheets-formulagoogle-sheets-querygoogle-query-language

Dynamic date function in Google sheets - how to implement it?


I was wondering if you could help me with a google sheets formula for the following issue:

enter image description here

I am trying to use a dynamic date formula so that I could extract all the letters from column B that appear in the last 40 days to a different tab in the same sheet. This should be always up-to-date because I would like to see if there are any changes every day.

I started with something like this:

=QUERY(Sheet1!A2:B, "select B WHERE A ”>=”&(TODAY()-39)")

But I keep getting an error. Any idea how to fix it? I'm a beginner in this and I need it for a project, so I'd appreciate any help I can get.


Solution

  • try:

    =QUERY(Sheet1!A2:B; "select B where A >= date '"&TEXT(TODAY()-39; "yyyy-mm-dd")&"'"; 0)
    

    or:

    =FILTER(B2:B; A2:A>=TODAY()-39)