Google-sheets – Get the latest specific date prior to today

google sheets

I am using the Google Analytics Add-On for Google Spreadsheets, and need to get data for the financial year to date. I have the finish date set as:

=TODAY()

Which is working fine. Now I need to have a start date that is the 6th of April prior to today. I can enter this manually, but was wondering if there was a way of doing it using a formula working backwards from TODAY?

Best Answer

The following formula does this:

=if(date(year(today()), 4, 6) < today(), date(year(today()), 4, 6), date(year(today())-1, 4, 6))

It constructs date(year(today()), 4, 6), which is the 6th of April of the current calendar year. If this date is prior to today, it is the output. Otherwise, the year is reduced by 1.