• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Datedif

manoj_th

Member
Hello Sir,

When using the above formula for the following dates:
01/01/2016 and 12/31/2045, the result is "29", where as it should return "30" which is correct "=DATEDIF(H9,H10,"Y")" (H9 and H10 are cell address).
But if I use "=DATEDIF(H9,H10,"M")" and the result divided by 12, getting "30".

How to get the answer "30" by using "Y" in the formula.
Please suggest.
Manoj
 
Hi:

Just add 1 to your date if formula to get inclusive no: of years. If you divide your date if function with 12 (as mentioned in your post) you will get something like 29.9166666666667 not exactly 30.

Thanks
 
Hi Manoj,

Datedif calculates number of complete years "between" two dates.
If you simply do:
=YEAR(H10)-YEAR(H9)
result would be same i.e. 29

another example is:
H9 = 01-Jan-16
H10 = 31-Dec-16

You may want the result = 1, but the formula will calculate 0

Just add +1 at the end, as Nebu advised:
=DATEDIF(H9,H10,"y")+1

Note: Datedif is not much reliable function as discussed earlier in the forum.

Regards,
 
Back
Top