YEARFRAC & Leap Years

  • It looks like a pretty silly problem but it's driving me mad.

    The yearfrac function takes a two dates and a basis. Now assume basis = 1 ( Act / Act ) and two cases:

    1) 06-Jan-06 -> 06-Jan-08 ( 730 days ) = 1.998175182 =>> divisor = 730/1.998175182 = 365.33333

    2) 06-Jan-05 -> 06-Jan-07 ( 730 days ) = 2 =>> divisor = 730/2 = 365

    In case 1) 2008 is a leap year ( but the "leap" has yet to come! ). Can anyone explain me the logic behind? I suppose the extra day is divided by 3 but where is the "Actuality" of the divisor?


  • Re: Yearfrac Calculation


    I don't think the fact that


    the "leap" has yet to come!

    matters. Your range in case 1) covers 3 different years, 1 of which is a leap year therefore the average days per year = 365.33333. This I think


    is the "Actuality" of the divisor



  • Re: Yearfrac Calculation

    yearfrac - Fraction of year between dates
    YearFraction = yearfrac(StartDate, EndDate, Basis)

    Not sure about leapyear, it has always been a pain I reCall and something jiuk avoids. I have given the systax so You can check Your spot on just in case

    jiuk[hr]*[/hr] Auto Merged Post;[dl]*[/dl]Also see ----

    YearFraction = yearfrac(StartDate, EndDate, Basis) returns a fraction based on the number of days between dates StartDate and EndDate using the given day-count basis. If EndDate is earlier than StartDate, Fraction is negative.

    YearFraction = yearfrac('14 mar 01', '14 sep 01', 0)

    YearFraction =


    YearFraction = yearfrac('14 mar 01', '14 sep 01', 1)

    YearFraction =


    See Also

    days360, days365, daysact, daysdif, months, wrkdydif, year, yeardays

    NOTE __ Credit to the author of this information jiuk has nabbed it, be happy to edit the post on evidence of Your work, sorry buddy I cant remember its old stuff I have saved <shrug> As always full credit where due

  • Re: YEARFRAC &amp; Leap Years

    Thanks guys!

    it's probably true that 'Yearfrac' work just for period below/equal to one year. What is misleading is that it works for all date constellations for all method but Act/Act.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!