I have been using the yearfrac calc but have notised the following when you
use periods across a leap year:
Date Days Yearfrac Yearfrac from start date
per period
30-Jun-93
30-Jun-94 365 1.0000 1.0000
30-Jun-95 365 1.0000 2.0000
30-Jun-96 366 1.0000 3.0007
Does this indicate an error when using this function?
Chip Pearson wrote this to me in 2001 when I had a similar question regarding
YEARFRAC("1/1/00","1/1/02",1) equals 2.000912409
===========================================
I suspect it is a bug within the YEARFRAC function. MS hasn't published
(that I know of) how it actually calculates the YEARFRAC value. There are
366 days between 1-Jan-2000 and 1-Jan-2001, 365 days between 1-Jan-2001 and
1-Jan-2002, and 731 days between 1-Jan-2000 and 1-Jan-2002.
I can't find any combinations of these values which come up with
2.000912409. Even using the different Basis values for either the first or
the second year, I can't get the same answer MS does.
The result *should* be exactly 2 (731/731) if it is using actual day counts
of both years, or 2.00274 (731/365) if it is using a 365 day year, or
1.99727 if it is using a 366 day year. Note that in these cases, the
fractional part of the number represent either 1/365 or 1/366, or 1 day.
This is to be expected.
But the fraction part of the MS answer (0.000912409) represents about 1
minute, 20 seconds, which makes no sense at all.
For what it is worth, I've always thought the YEARFRAC function was rather
useless. A "fraction of a year" strikes me as something left over from the
dark ages of finance before computers were used.
This may be one of those cases in which MS knows the answer is incorrect,
but doesn't fix it because "those who use it have already worked around the
problem, and fixing it would break the work-arounds".
========================================
--ron