DATEDIF's known issue in "md" unit

Silver Contributor

Hi folks,

 

On this link:

DATEDIF Function - Support Page

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!

 

 

DATEDIF.JPG

 

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

Fix the known issue of DATEDIF function in "md" unit and document this function!

 

Any comments?

1 Reply

@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)