Function B_Yield_ISMA(Sett_d As Date, Mat_d As Date, Cpn As Double, Price As Double) As Double ' Calculates the yield of a coupon bearing bond (ISMA) Dim L As Double, t As Double, sz As Double, T1 As Double, T2 As Double, T3 As Double Dim k1 As Double, k2 As Double Dim n As Long L = Application.Days360(Sett_d, Mat_d) / 360 n = Int(L) t = L - n sz = Cpn * (1 - t) T1 = Application.Rate(L, Cpn, -Price, 100) If IsError(T1) Then T2 = -1 Else k1 = (-Application.PV(T1, n, Cpn, 100) + Cpn) / (1 + T1) ^ t - sz T2 = T1 + 0.00005 k2 = (-Application.PV(T2, n, Cpn, 100) + Cpn) / (1 + T2) ^ t - sz While Abs(k2 - Price) > 0.00005 T3 = T1 + (Price - k1) * (T2 - T1) / (k2 - k1) T1 = T2 k1 = k2 T2 = T3 k2 = (-Application.PV(T2, n, Cpn, 100) + Cpn) / (1 + T2) ^ t - sz Wend B_Yield_ISMA = T2 End Function