## Coupon Days Before Settlement FunctionMath Financial Class

```Public Function CouponDaysBeforeSettlement( _
ByVal vSettlement As Variant _
, ByVal vMaturity As Variant _
, ByVal vFrequency As Variant _
, Optional ByVal vBasis As Variant _
, Optional ByVal vExcelVersion As Variant _
) As Variant```

### Calculates the number of days between the previous coupon date and the settlement date.

Examples:
```    CouponDaysBeforeSettlement(#1/15/96#, #2/28/99#, 1, US_NASD_30_360) = 315
CouponDaysBeforeSettlement(#1/15/96#, #2/28/99#, 2, US_NASD_30_360) = 135
CouponDaysBeforeSettlement(#1/15/96#, #2/28/99#, 4, US_NASD_30_360) = 45```
```    CouponDaysAfterSettlement Function
CouponDays Function
PreviousCouponDate Function
CouponDaysBeforeSettlementTest Subroutine
COUPDAYBS Function (Microsoft Excel)```
vSettlement: Settlement date for the security. The date after the issue date when the security is traded to the buyer. Function returns Null if vSettlement is Null, cannot be interpreted as a Date, or is greater than the maturity date vMaturity. The time component of vSettlement (if any) is ignored.
vMaturity: Maturity date for the security. The date on which the security expires. Function returns Null if vSettlement is Null or cannot be interpreted as a Date. The time component of vMaturity (if any) is ignored.
vFrequency: Number of coupon payments per year. Use 1 for annual payments, 2 for semiannual payments, or 4 for quarterly payments. vFrequency is rounded to the nearest integer. Function returns Null if vFrequency is not 1, 2, nor 4.
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.
vExcelVersion: Optional True or False value. This value only affects this function when vBasis is US_NASD_30_360. True if the function should return the exact same results as the Microsoft Excel COUPDAYBS function when vBasis is US_NASD_30_360, and False if it should use the Securities Industy Association definition of the US NASD 30/360 day count basis. vExcelVersion defaults to False (use the SIA definition for the US NASD 30/360 day count basis when vBasis is US_NASD_30_360) if it is missing or Null or cannot be interpreted as a Boolean value.
Note: This function returns the exact same results as the Microsoft Excel COUPDAYBS function when the vExcelVersion argument is True.
v2.0 Addition: This function is new to this version of Entisoft Tools.