<-- Previous || Up || Next -->

Year Fraction Function
Dates Times Class

Public Function YearFraction( _
      ByVal vFm As Variant _
    , ByVal vTo As Variant _
    , Optional ByVal vBasis As Variant _
    ) As Variant

Return the fractional part of the year (or years) between two dates, according to the specified day count basis.

Examples:
    YearFraction(#1/15/95#, #6/30/95#, Actual_Actual) = 0.454794520547945
    YearFraction(#1/15/95#, #6/30/96#, Actual_Actual) = 1.45554035567715
    YearFraction(#1/15/96#, #6/30/96#, Actual_Actual) = 0.456284153005464
    YearFraction(#1/15/96#, #6/30/96#, US_NASD_30_360) = 0.458333333333333
    YearFraction(#1/15/96#, #6/30/96#, Actual_360) = 0.463888888888889
See also:
    YearFractionTest Subroutine
    DayOfYear Function
    AgeDifference Function
    YEARFRAC Function (Microsoft Excel)
vFm: The first date. Function returns Null if vFm is Null or cannot be interpreted as a Date.
vTo: The second date. Function returns Null if vTo is Null or cannot be interpreted as a Date.
vBasis: Optional day count basis that determines how to count the difference in days and years. One of the following day count basis constants: US_NASD_30_360, Actual_Actual, Actual_360, Actual_365, or European_30_360. vBasis defaults to US_NASD_30_360 if it is missing or Null or cannot be interpreted as a number. Function returns Null if vBasis is not one of the recognized Day Count Basis constants.
Note: This function returns the exact same results as the Microsoft Excel YEARFRAC function.
v2.0 Addition: This function is new to this version of Entisoft Tools.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.