Michael has attended:
Excel Advanced course
DATEDIF error
I'm using the following DATEDIF formula to work out the number of days it takes to complete a task: =DATEDIF([@[REFERRAL_START_DATE]],[@[REFERRAL_COMPLETION_DATE]], "d").
The two sets of data contain dates in format DD-MM-YYYY.
However the data in the REFERRAL_COMPLETION_DATE columns also includes blank fields where the task has not yet been completed, and so there is no end date. This results in a #NUM error for those fields where there's no end date for the formula to calculate.
I would like for the #NUM error fields to be replaced with a word such as 'Onhand' or simply be left blank rather than have this error.
Is there an additional formula I can add onto the DATEDIF to automatically work this out (also allowing for the data to be presented in a pivot table/chart)?
Thanks
RE: DATEDIF error
Hello Michael,
Thank you for question. There is a very useful function in Excel called IFERROR. You place this function in front of the function that results in an error message. IFERROR shows your message of choice instead of the usual error message.
The syntax is:
=IFERROR("Another function", "Your message in the place of the error message")
In your example, this would be:
=IFERROR(DATEDIF([@[REFERRAL_START_DATE]],[@[REFERRAL_COMPLETION_DATE]], "d"),"Onhand")
I hope this solves your issue.
Kind regards
Marius Barnard
Excel Trainer
STL