← Prev in month ← Prev in thread

YEARFRAC differences

From
David A. Wheeler <>
Date
2006-08-09T23:54:54+00:00
ID
Thread
YEARFRAC differences
YEARFRAC has a minor variance between Excel and at least OOo -
anybody know more about the unwritten semantics of this function?

Background: I love the fact that we're creating all these test cases.
It helps us be clear on the spec, and it also helps us discover
stuff that we _thought_ everyone agreed on... but maybe not.

Here's one such case: YEARFRAC.  OpenOffice.org and Excel agree
on results generally, including lots of complicated cases.
But sometimes when basis=1 (real year, real month!),
the results differ by a very small amount.

Given:
 =YEARFRAC("2000-12-26";"2001-02-11";1)
Excel produces: 0.128767123
OOo produces:  0.128415300546448

These days are 47 days apart, and these answers
are consistent with the programs deciding on a
different number of days in the year:
0.128767123287671 ... a 365-day year, Excel's answer.
0.128415300546448 ... a 366-day year, OOo's answer.

Since 2000 was a leap year, and 2001 wasn't, that makes sense.

Anyone know more about the unwritten rules for this function?
Any comments?

For the moment, I'm going to embed a pile of test cases
for this function, so that we can reveal "hidden" semantics,
and see if anyone else already knows something I don't.

--- David A. Wheeler
← Prev in month ← Prev in thread