demian
09-29-2017, 10:19 AM
Hi,
I'm trying to code the user-defined function calculating the forward rates.
I do not understand why this code doesn't work:
Function ForwardRate(freq As Integer, Date1 As String, Date2 As String, Rate1 As Double, Rate2 As Double) As Double
ForwardRate = (((1 + Rate2 / freq) ^ (freq * Date2) / (1 + Rate1 / freq) ^ (freq * Date1) ^ (1 / (freq * (Date2 - Date1)))) - 1) * freq
End Function
Should I declare Date1 and 2 as double, which is not in date format, but t=1.5, 2 , 2.5.. etc.
I did, but it is still displaying as N/A
Regards,
Demian
I'm trying to code the user-defined function calculating the forward rates.
I do not understand why this code doesn't work:
Function ForwardRate(freq As Integer, Date1 As String, Date2 As String, Rate1 As Double, Rate2 As Double) As Double
ForwardRate = (((1 + Rate2 / freq) ^ (freq * Date2) / (1 + Rate1 / freq) ^ (freq * Date1) ^ (1 / (freq * (Date2 - Date1)))) - 1) * freq
End Function
Should I declare Date1 and 2 as double, which is not in date format, but t=1.5, 2 , 2.5.. etc.
I did, but it is still displaying as N/A
Regards,
Demian