# Help with IF and DateTime_Diff

Topic Labels: Formulas
Solved
1012 4
cancel
Showing results for
Did you mean:
7 - App Architect
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
1 Solution

Accepted Solutions
6 - Interface Innovator

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 4
7 - App Architect

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
7 - App Architect

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

6 - Interface Innovator

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.

7 - App Architect

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