# Date Math

#### garygersh2

##### New Member
I'm trying to create a formula that will calculate the differnce between any two dates in years, months and days. Is there an easy way to do this?

### Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
On 2002-08-27 10:22, garygersh2 wrote:
I'm trying to create a formula that will calculate the differnce between any two dates in years, months and days. Is there an easy way to do this?

[1]

=DATEDIF(A1,B1,"y")

where A1 < B1, gives the difference in years.

[2]

=DATEDIF(A1,B1,"m") the difference in months.

[3]

=DATEDIF(A1,B1,"d") the difference in days.

=YEARFRAC(A1,B1) is "similar" to [1].

=B1-A1 is similar to [3].

=DATEDIF(A1,A2,"y")&" years "&DATEDIF(A1,A2,"ym")&" months "&DATEDIF(A1,A2,"md")&"days"

Replies
5
Views
132
Replies
16
Views
538
Replies
2
Views
115
Replies
14
Views
251
Replies
3
Views
347

1,203,072
Messages
6,053,377
Members
444,659
Latest member
vuphihung

### 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?

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