Formula to return duration

mLife

New Member
Joined
Dec 12, 2019
Messages
3
Office Version
  1. 2013
  2. 2010
Platform
  1. Windows
Hi,
Firstly, I’m an absolute novice on excel. However, I’m trying to get excel to return an accurate duration in years and months, based on a start date and end date. I found the formula below online:

=DATEDIF(A2,B2,"y")&" Years, "&DATEDIF(A2,B2,"ym")&" Months"

the issue with this formula is that it isn’t accurate when trying to establish a contract duration or length of service. It’s seems to miss a month off. For example, 1/1/19 to 31/03/2020 is calculated as 1 year, 2 months using that formula, but in real terms it’s 1 year and 3 months. It’s seems like the date has to enter in to the next month before a month registers.

Does anyone have a formula/workaround to combat this issue?

My apologies in advance if this has been posted previously.
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
Try using
=DATEDIF(A2,B2,"y")&" Years, "&DATEDIF(A2,B2,"ym")+1&" Months"
As the end date is a completed month, it won't count that month
 
Upvote 0
Depends on what you're trying to do, but you might also consider something like this where you round the months instead of specifically needing to elapse 100% of the month to count:
=INT((B1-A1)/365)&" Years " & ROUND(MOD((B1-A1)/365,1)*12,0)&" Months"
 
Upvote 0
Try using
=DATEDIF(A2,B2,"y")&" Years, "&DATEDIF(A2,B2,"ym")+1&" Months"
As the end date is a completed month, it won't count that month
Thanks, I tried this, however when formula calculates 11 months, the +1 defaults month to 0 and it doesn’t add another year.
 
Upvote 0
Depends on what you're trying to do, but you might also consider something like this where you round the months instead of specifically needing to elapse 100% of the month to count:
=INT((B1-A1)/365)&" Years " & ROUND(MOD((B1-A1)/365,1)*12,0)&" Months"
Perfect! I think you’ve solve the issue. Thank you so much. This provided quite a headache for the excel experts in my office. Thanks again.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top