Calculate Year and Month Between Two Dates

Chris Waller

Board Regular
Joined
Jan 18, 2009
Messages
183
Office Version
  1. 365
Platform
  1. Windows
I have some date ranges in column A i.e.06/04/50 - 05/05/50 and in column B a date in the following format dd/mm/yyyy. In Column C, I want to calculate the years and months from column B to the first date in column A. In Column D, I want to calculate the years and months from Column B to the second date in column A. I hope I have explained what I am trying to do clearly and I think the answer may include parts if not all of the following formulas, but trying to combine the two formulas is proving troublesome. TIA

=MID(A2,1,8)

=DATEDIF(A1621,B1621,"y")&" years, "&DATEDIF(A1621,B1621,"ym")&" months"
 

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
=DATEDIF(MIN(DATEVALUE(LEFT(A20,FIND("-",A20)-2)),DATEVALUE(MID(A20,FIND("-",A20)+2,9))),B20,"Y")

is the formula for column C - same in COlumn D but swap the min for a max (you obviously have to add the bit for the months too but I wasn't going to type all that!!!)

HTH

:)
 
Upvote 0
Can you post an example of the data and the result you want? Use the addin at Excel Jeanie Html to get table code for the forums.

Calculation using 1st Date
Calculation using 2nd Date
06/04/1950 - 05/05/5006/05/2010 60 years, 1 months
60 years, 0 months

<colgroup><col><col><col><col></colgroup><tbody>
</tbody>
 
Upvote 0
energman,

Your post was helpful, however I am only a novice at this and do not have the knowledge to be able to modify it to include the years and months. I have however, managed to change the min to max, but that is as far as I can go. TIA
 
Upvote 0
Your first post was well on the right track so I assumed you could take it from there. However here is the full version:

In C

=DATEDIF(MIN(DATEVALUE(LEFT(A20,FIND("-",A20)-2)),DATEVALUE(MID(A20,FIND("-",A20)+2,9))),B20,"Y")&" Years " & DATEDIF(MIN(DATEVALUE(LEFT(A20,FIND("-",A20)-2)),DATEVALUE(MID(A20,FIND("-",A20)+2,9))),B20,"YM")&" Months"

In D change the two mins for max

Job done!
 
Upvote 0

Forum statistics

Threads
1,217,389
Messages
6,136,317
Members
450,003
Latest member
AnnetteP

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