Help

The Community will be temporarily unavailable starting on Friday February 28. We’ll be back as soon as we can! To learn more, check out our Announcements blog post.

Value based on relation to date

Topic Labels: Formulas
Solved
Jump to Solution
1559 3
cancel
Showing results for 
Search instead for 
Did you mean: 
FortGjort_Trani
6 - Interface Innovator
6 - Interface Innovator

Hi!

I want a field to show one of three values (Active, Expires in a week or Expired) depending on if the field “Startdatum” is after today, within a week or before today. How do I solve this?

Thanks!

1 Solution

Accepted Solutions
Kamille_Parks
16 - Uranus
16 - Uranus

You need three nested IF() statements: one to check if the date field is filled in, one to test if its expired, and another to differentiate between those expiring within a week or sometime in the future.

IF(
   {Startdatum},
   IF(
      {Startdatum} < TODAY(), 
      "Expired",
      IF(
         DATETIME_DIFF({Startdatum}, TODAY(), "days") <= 7, 
         "Expires in a week",
         "Active"
      )
   ),
   "No date"
)

See Solution in Thread

3 Replies 3
Kamille_Parks
16 - Uranus
16 - Uranus

You need three nested IF() statements: one to check if the date field is filled in, one to test if its expired, and another to differentiate between those expiring within a week or sometime in the future.

IF(
   {Startdatum},
   IF(
      {Startdatum} < TODAY(), 
      "Expired",
      IF(
         DATETIME_DIFF({Startdatum}, TODAY(), "days") <= 7, 
         "Expires in a week",
         "Active"
      )
   ),
   "No date"
)

Worked like a charm! Thanks alot :grinning:

Hi again! Can I have it so it doesn’t say “#ERROR” when “Startdatum” is empty?