Following formula returns the number of days between the two dates:
DATEDIF(Date1, Date2, "d")
Which is equivalent to Date2 - Date1
and return the days only.
In your case, you are subtracting "Date entered 6." from "Date Entered 5.".
So for the items which has [Date entered 6.] > [Date Entered 5.]
, calculated column returning as #Name?
.
Workaround:
Use Validations on dates so that Date Entered 5.
will always be greater than Date entered 6.
.
Use ISERROR() function:
ISERROR()
takes only one parameter and returns TRUE
or FALSE
. It is typically used inside an IF()
statement to evaluate a formula. What you probably want is something like
=if(ISERROR(DATEDIF([DATE1] , [DATE2] ,"d")),"0", DATEDIF([DATE1] , [DATE2] ,"d"))
In words: If the DATEDIF
function returns an error, use "0", else use the result of the DATEDIF
function.
For Your Case, Following formula will work:
=IF(OR(ISBLANK([Date entered 6.]),ISBLANK([Date Entered 5.])),"No KPI dates",IF(ISERROR(DATEDIF([Date Entered 5.],[Date entered 6.],"D")),"Date entered 6 is less than Date Entered 5",DATEDIF([Date Entered 5.],[Date entered 6.],"D")))
Date entered 6.
andDate Entered 5.
are date fields? Also how you have returned your calculated field as number or something else?