# Re: If statement taking the results of the first IF

Solved
304 0
cancel
Showing results for
Did you mean:
6 - Interface Innovator

I have a formula which calculates the # of days between two dates. I want to add if the resulting value is <0, then the value should be set to 0, otherwise, keep the value.

This is the calculate of two dates. How do i add the second part? I tried nesting, but that didnt work,

F(
OR({🚩Workflow Status} = "Complete",{🚩Workflow Status}"Released to Customer"),
DATETIME_DIFF({🚩Actual Eng. Delivery Date},{🚩Original Planned P50 Date},'days')
,"")
1 Solution

Accepted Solutions
11 - Venus

Hey @rfscott2016

I haven't tested this, but this is generally what you're looking for:

``````IF(
OR(
{🚩Workflow Status} = "Complete",
{🚩Workflow Status} = "Released to Customer"
),
IF(
DATETIME_DIFF(
{🚩Actual Eng. Delivery Date},
{🚩Original Planned P50 Date},
'days'
) < 0,
0,
DATETIME_DIFF(
{🚩Actual Eng. Delivery Date},
{🚩Original Planned P50 Date},
'days'
)
)
)``````
11 - Venus

Hey @rfscott2016

I haven't tested this, but this is generally what you're looking for:

``````IF(
OR(
{🚩Workflow Status} = "Complete",
{🚩Workflow Status} = "Released to Customer"
),
IF(
DATETIME_DIFF(
{🚩Actual Eng. Delivery Date},
{🚩Original Planned P50 Date},
'days'
) < 0,
0,
DATETIME_DIFF(
{🚩Actual Eng. Delivery Date},
{🚩Original Planned P50 Date},
'days'
)
)
)``````