Using vb6 Rate function, I am getting to many errors(not able to find interest rate), especially when I am using large loan amounts like 99,000,000, etc.
below I am try to use Newton's equation to find and maybe not get so many "no finds"... I am quite evidently doing something wrong. Can anyone help me?? Trying to iterate i to find the correct rate, but no luck. worked on this for a while. Thanks in advance.
'Function is "FindRate"
'FindRate = (Rate(LPeriod, -LPymt, LAmt, FVal, PayType, guess) * LPymtsPerYr) * 100 * works ok, but to many "no finds"
'FindRate = (Rate(360, -699.21, 100000, 0, 0, .01) * 12) * 100
' P - P(1 + i)^- N - iA
' i(new) = i - ---------------------- Note: f1,f2,n,n1,n2,FindRate are all doubles
' N P(1 + i)^(-N-1) - A
For X = 1 To 10
n = (1 + i) ^ -LPeriod '.027816689209355
n1 = LPymt * n '19.9359429894527
n2 = n1 - (i * LAmt) '-980.064057010547
f1 = LPymt - n2 '1696.75405701055
n = (1 + i) ^ (-LPeriod - 1) '.027541276444906
n1 = LPymt * n '19.7385574152997
n2 = n1 - LAmt '-99980.26144425847
f2 = LPeriod * n2 '-35992894.1193305
FindRate = i - (f1 / f2)
FindRate = Format(FindRate, "0,000.0000000")
i = FindRate
Next X
below I am try to use Newton's equation to find and maybe not get so many "no finds"... I am quite evidently doing something wrong. Can anyone help me?? Trying to iterate i to find the correct rate, but no luck. worked on this for a while. Thanks in advance.
'Function is "FindRate"
'FindRate = (Rate(LPeriod, -LPymt, LAmt, FVal, PayType, guess) * LPymtsPerYr) * 100 * works ok, but to many "no finds"
'FindRate = (Rate(360, -699.21, 100000, 0, 0, .01) * 12) * 100
' P - P(1 + i)^- N - iA
' i(new) = i - ---------------------- Note: f1,f2,n,n1,n2,FindRate are all doubles
' N P(1 + i)^(-N-1) - A
For X = 1 To 10
n = (1 + i) ^ -LPeriod '.027816689209355
n1 = LPymt * n '19.9359429894527
n2 = n1 - (i * LAmt) '-980.064057010547
f1 = LPymt - n2 '1696.75405701055
n = (1 + i) ^ (-LPeriod - 1) '.027541276444906
n1 = LPymt * n '19.7385574152997
n2 = n1 - LAmt '-99980.26144425847
f2 = LPeriod * n2 '-35992894.1193305
FindRate = i - (f1 / f2)
FindRate = Format(FindRate, "0,000.0000000")
i = FindRate
Next X