Google-sheets – How to do a date formula in Google Spreadsheets

google sheets

I have to do a query that increments automatically the date year by year. For example I use this formula:

=INDEX(query('Scheda Intervento'!C3:K14;"select sum (K) where (F >= date '2013-01-01' and F <= date '2013-01-31' and C = '" & A3 &"')");2;1)

But every year I have to change the date in 2014 , 2015 etc.

Best Answer

Try this

=INDEX(query('Scheda Intervento'!C3:K14;"select sum (K) where (F >= date '"&YEAR(NOW())&"-01-01' and F <= date '"&YEAR(NOW())&"-01-31' and C = '" & A3 &"')");2;1)

I used the function YEAR(NOW())