# Formula that shows "Yes" if date is in the previous year

Topic Labels: Formulas
Solved
829 2
cancel
Showing results for
Did you mean:
5 - Automation Enthusiast

Hello everyone,

I have currently the following formula in my table that shows "Yes" if the date in "Fin contrat" is in a future month. I am trying, but with no success, to adapt this formula to show "Yes" in another column if the same date is in the previous year (so currently 2022).

Thanks! 🙂

`IF( IS_AFTER(    {Fin contrat},    DATEADD(      DATEADD(        DATETIME_PARSE(           "01 " & DATETIME_FORMAT(             TODAY(),             "MM YYYY"           ),           "DD MM YYYY"        ),        "1",        "months"     ),     "-1",     "days"  )),"Yes","No")`

1 Solution

Accepted Solutions
10 - Mercury

Hi @ClarenceK,

You could adapt this formula to something like:

``````IF(
IS_BEFORE(
{Fin contrat},
DATETIME_PARSE('1/1/' & YEAR(NOW()))
),
'Yes',
'No'
)``````

*but this would be 'yes' for all previous years, not just last year.

If you want to check if a date's year = last year, you could do:

``````IF(
'Yes',
'No'
)``````

Hope that helps!
-Stephen

2 Replies 2
10 - Mercury

Hi @ClarenceK,

You could adapt this formula to something like:

``````IF(
IS_BEFORE(
{Fin contrat},
DATETIME_PARSE('1/1/' & YEAR(NOW()))
),
'Yes',
'No'
)``````

*but this would be 'yes' for all previous years, not just last year.

If you want to check if a date's year = last year, you could do:

``````IF(
'Yes',
'No'
)``````

Hope that helps!
-Stephen

5 - Automation Enthusiast

That's perfect, thank you very much @Stephen_Orr1!