Forum Discussion

Haytham Amairah's avatar
Haytham Amairah
Silver Contributor
Nov 10, 2017

DATEDIF's known issue in "md" unit

Hi folks,

 

On this link:

https://support.office.com/en-us/article/DATEDIF-function-25dba1a4-2812-480b-84dd-8b32a451b35c

You will find at the bottom of the webpage a workaround for the DATEDIF's known issue in "md" unit!

But be careful, this workaround isn't complete; because it does not take into account the start date! 
It only gives you the correct result if the start date is the first day of a month.

 

What if the start date was: 9/9/2014 and the end date was: 7/24/2016?

That workaround will give me the result of 23 which is wrong! 
But DATEDIF will give me the result of 15 which is correct!

 

 

 

I put this topic on the Excel UserVoice site on this link:

https://excel.uservoice.com/forums/304921-excel-for-windows-desktop-application/suggestions/32207203-fix-the-known-issue-of-datedif-function-in-md-un

 

Any comments?

1 Reply

  • Tom_S-J's avatar
    Tom_S-J
    Copper Contributor

    Haytham Amairah 

     

    Hi

    I think I managed to complete the "workaround" with this formula:

    =IF(DAY(EndDate)<DAY(StartDate);EndDate-DATE(YEAR(EndDate);MONTH(EndDate)-1;DAY(StartDate));EndDate-DATE(YEAR(EndDate);MONTH(EndDate);1)-DAY(StartDate)+1)

     

Resources