# DateDif()

#### Evagrius Ponticus

##### Well-known Member
Hi,

Can anyone help me understand why this formula gives me a result of -1?

a1 = 7/31/2012
b1 = 3/2/2013

datedif(A1,B1,"MD")

### Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.

#### mvptomlinson

##### Well-known Member
I believe it's because:

1. The "MD" qualifier is only going to tell you how many days there are between the two dates assuming they are in the same month -- LEAVING off the Years and Months part. So if you put 4/1/07 to 5/2/07 it would result in 1.

2. HOWEVER -- In your example, 7/31/2012 to 3/2/2013, while there are technically 7 complete months, there really is no 2/31/2013. My best guess is that it is calculating 3/3/2013 as the 31st day (the end of the 7th full month) and then showing you that there is -1 day "left over". Notice if you change your end date to 3/3/2013 the result becomes 0. Then 3/4/2013 = 1..etc.

It's odd, and complicated, but mostly odd. Perhaps these explanations and examples could help further explain DATEDIF: http://www.cpearson.com/excel/datedif.aspx

#### Evagrius Ponticus

##### Well-known Member
Thanks MVP - The DATEDIF function never makes sense to me - all I am trying to do find the difference between those two dates for months and days.

Don't know how you are getting 2 Adam - I tried it again and I still get -1??

#### Brunts

##### Board Regular
I'm on Excel 200 and I'm getting the -1 as an outcome.

Datedif doesn't always create the outcome expected and can give a response in negative days

See the Thread titled "Bug in DATEDIF in Excel 2007?

Replies
3
Views
147
Replies
2
Views
293
Replies
7
Views
66
Replies
4
Views
91
Replies
3
Views
282

1,191,499
Messages
5,986,917
Members
440,064
Latest member
Pluong91

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

### Which adblocker are you using?

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

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