datedif problem

  • Thread starter Thread starter Legacy 65404
  • Start date Start date
L

Legacy 65404

Guest
Hi all... I think I have a problem....

I used a datedif between the dates: 03/11/1986 and 03/10/1988, and it returned me 1 year, 11 months and 28 days!!! (it should return 29 days!!)

when I tested, I put between 03/11/1986 and 03/11/1988 and returned 2 whole years, what is correct...

It may have happened because 1986 is a leap year... but I don't know what to do...
do you guys have any clue??

thx all in advance...

(please help...)
 
If you are expecting 1 day short of 2 years to always be 1 year 11 months and 29 days then that isn't going to happen with DATEDIF, depending on your dates you could get 27, 28, 29 or 30 days.

DATEDIF doesn't treat a month as 30 days, it looks at the actual number of days so, of course, because months are variable lengths you won't get consistent results.

What are you trying to do?
 
Upvote 0

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
****.. I actually saw what happened, it was as you said, barry... because feb has 28 days, after the 27th of the 11th month, we get 2 years...

thanks... i guess this is the way it was supposed to be
 
Upvote 0
If you are expecting 1 day short of 2 years to always be 1 year 11 months and 29 days then that isn't going to happen with DATEDIF, depending on your dates you could get 27, 28, 29 or 30 days.

DATEDIF doesn't treat a month as 30 days, it looks at the actual number of days so, of course, because months are variable lengths you won't get consistent results.

What are you trying to do?

And this is why what I was suggesting wouldn't work either.
Gene, "The Mortgage Man", Klein
 
Upvote 0

Forum statistics

Threads
1,225,072
Messages
6,182,695
Members
453,132
Latest member
nsnodgrass73

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