98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » DATEDIF error
DATEDIF error
Resolved · Low Priority · Version 2016
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
Training information:
See also:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Showing all menu itemsIf you go into a pull down menu you usally find that you get a selection of items(this is the default) or sometimes everything. If you only get a selectiopn you have to go to the double arrows at the bottom of the menu and click it to get all of the hidden items. |