I know others disagree with me on this, but I would recommend not using DATEDIF, especially if the worksheet will be used for something important. Here is a post I have given in the past explaining why I am making this recommendation...
You might want to reconsider using the DATEDIF function. It is an undocumented (and, thus, probably an unsupported) Excel function which appears to be broken in XL2007 at Service Pack 2. Someone recently posted this message as part of a newsgroup question...
************************************************** *******************
=DATEDIF(DATE(2009,6,27),DATE(2012,1,5),"md")
In XL2003, the above formula gives me the correct answer of 9. However,
in Excel 2007, it gives me 122. The 122 increases in value until it
hits 143 on 1/26/2012 and then, on 1/27/2012, the difference becomes 0.
************************************************** *******************
An informal survey of fellow MVPs shows the above formula works correctly in the initial release of XL2007 and its SP1, but does not work correctly in SP2; hence, it appears to be broken at that level. The problem is that the extent of the breakage is unknown (and probably indeterminable). In addition, I would say, being an undocumented (and, thus, probably an unsupported) function, the odds of Microsoft spending the time to search down and fix whatever broke is slim. In addition, again because it is probably unsupported, the extent of any future breakage in the function due to other code change Microsoft makes elsewhere in Excel is unknowable... something that works today may not work tomorrow and Microsoft will probably never fix it. This would seem to mean that DATEDIF cannot be counted on to work correctly from XL2007 SP2 onward. And even if Microsoft did fix the problem in a subsequent Service Pack, any of your users who remained at SP2 would be subjected to incorrect result.
ADDITIONAL FOLLOW-UP #1
-------------------------------
There is an indication that this might have been fixed in XL2010, however it remains broken in XL2007 as SP2, so if you are in a mixed environment of these two versions, you would be asking for trouble to continue using it. And even if you move wholly to XL2010, there is always the "they broke it once so what would stop them from breaking it again" possibility. After all, I doubt that Microsoft deliberately set out to break DATEDIF in the first place, so the breakage was probably due to an unanticipated side effect from some other change Microsoft made to Excel in SP2. Given that, whose to say it won't happen again? Personally, I am still recommending that DATEDIF not be used, but the final decision as to how much you are willing to risk your data to this undocumented function is up to you.
ADDITIONAL FOLLOW-UP #2
-------------------------------
A Microsoft Answers forum regular named joeu2004...
joeu2004 - Microsoft Answers
posted this link...
DATEDIF function - Support - Office.com
which documents DATEDIF for the "Microsoft Office SharePoint Server 2007" and "Windows SharePoint Services 3.0". Since the first one is an extension of Office, one might conclude that DATEDIF is "officially" documented. Personally, I don't conclude that, but to be fair I thought I would include the link and let you draw your own conclusion. Personally, I am still holding firm to my recommendation that DATEDIF not be used anymore (for the reasons I gave in the paragraph before my ADDITIONAL FOLLOW-UP #1).
Bookmarks