ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   yearfrac (https://www.excelbanter.com/excel-worksheet-functions/46940-yearfrac.html)

slymeat

yearfrac
 
I am using the yearfrac function to calculate the difference between dates

If I use the first date as 31/03/2005 and the 2nd date as 31/03/2009 and use
the yearfrac function, the result is 4.0027397260274

Why is it not 4.00 even?


Duke Carey

2008 is a Leap year, so you are getting 1461 days divided by 365 days

"slymeat" wrote:

I am using the yearfrac function to calculate the difference between dates

If I use the first date as 31/03/2005 and the 2nd date as 31/03/2009 and use
the yearfrac function, the result is 4.0027397260274

Why is it not 4.00 even?


Myrna Larson

I get that result if I use 3 as the 3rd argument. In that case, the actual
difference in days is used as the numerator, and the denominator is 365. The
only "basis" arguments which yield 4.000 are 0 and 4.

This function is "buggy", especially with arguments of 2 and 3 (or at least it
returns unexpected results). I think the fundamental reason for this is that
it was intended for use with time spans of less than one year, preferably with
both dates in the same calendar year, or, if they span a year-end, neither
year is a leap year.


On Fri, 23 Sep 2005 05:42:04 -0700, "slymeat"
.(donotspam) wrote:

I am using the yearfrac function to calculate the difference between dates

If I use the first date as 31/03/2005 and the 2nd date as 31/03/2009 and use
the yearfrac function, the result is 4.0027397260274

Why is it not 4.00 even?



All times are GMT +1. The time now is 10:35 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com