Skip to main content
Solved

Help with IF and DateTime_Diff

  • October 26, 2023
  • 4 replies
  • 30 views

Forum|alt.badge.img+17
IF({Last Renewal},
DATETIME_DIFF(
TODAY(),
{Last Renewal},
'days'
) > 365,
"🔴",
"🟢"
)
 
The above formula, without the first {Last Renewal}, works fine. But I have records that are empty and I want them blank. I obviously am not constructing my syntax correctly. I want to say that if {Last Renewal} is not blank, then do the following. as I said it works if take out the first {Last Renewal}. I'm sure it is simple. I just don't see it.
 
Thanks, Scott

Best answer by jwag

I think you're missing a 2nd if (nested). Try the following:

IF(
{Last Renewal},
IF(
DATETIME_DIFF(
TODAY(),
{Last Renewal},
'days'
) > 365,
"🔴",
"🟢"
),
""
)

 

This says: if the renewal date is not blank, then check the date diff, otherwise if it's blank, return blank.

4 replies

Forum|alt.badge.img+17
  • Author
  • Inspiring
  • October 26, 2023

A little clarification, I get a green emoji in the blank record. All else works. This is the formula that works, but has a the green emoji in the blank record.

IF(
DATETIME_DIFF(
TODAY(),
{Payment Date},
'days'
) > 365,
"🔴",
"🟢"
)
 
Again thanks, Scott

Forum|alt.badge.img+17
  • Author
  • Inspiring
  • October 26, 2023

A little clarification, I get a green emoji in the blank record. All else works. This is the formula that works, but has a the green emoji in the blank record.

IF(
DATETIME_DIFF(
TODAY(),
{Payment Date},
'days'
) > 365,
"🔴",
"🟢"
)
 
Again thanks, Scott

Screenshot of result of formula. Need Abernathy records be blank. Thanks ,Scott


Forum|alt.badge.img+13
  • Inspiring
  • Answer
  • October 26, 2023

I think you're missing a 2nd if (nested). Try the following:

IF(
{Last Renewal},
IF(
DATETIME_DIFF(
TODAY(),
{Last Renewal},
'days'
) > 365,
"🔴",
"🟢"
),
""
)

 

This says: if the renewal date is not blank, then check the date diff, otherwise if it's blank, return blank.


Forum|alt.badge.img+17
  • Author
  • Inspiring
  • October 27, 2023

Fantastic, Thanks! I was thinking that I probably needed another If statement. That worked perfectly. Best, Scott