Signature (Visual Basic / VBA)
Public Function YearFraction( _
ByVal vFm As Variant _
, ByVal vTo As Variant _
, Optional ByVal vBasis As Variant _
) As Variant
Code Example
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
Parameters
| Parameter | Description |
|---|---|
| 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. |
Notes & Version History
| 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. |