Help

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

Topic Labels: Formulas
Solved
Jump to Solution
697 2
cancel
Showing results for 
Search instead for 
Did you mean: 
ClarenceK
5 - Automation Enthusiast
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).

Can someone please help me achieve this?

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
Stephen_Orr1
10 - Mercury
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(
   YEAR({Fin contrat}) = YEAR(DATEADD(NOW(),-1, 'year')),
   'Yes',
   'No'
)

 

Hope that helps!
-Stephen

See Solution in Thread

2 Replies 2
Stephen_Orr1
10 - Mercury
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(
   YEAR({Fin contrat}) = YEAR(DATEADD(NOW(),-1, 'year')),
   'Yes',
   'No'
)

 

Hope that helps!
-Stephen

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