datedif error

Forum home » Delegate support and help forum » Microsoft Excel Training and help » DATEDIF error

DATEDIF error

resolvedResolved · 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


 

Excel tip:

Showing all menu items

If 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.
To turn this off so that you always get everything, go to Tools / Customize / Options Tab / "Always show full menus". Make sure there is a tick in the box and you will always have every item.

View all Excel hints and tips


Server loaded in 0.09 secs.