Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Bamah Cohen   on Nov 03 In MS Office Category.

  
Question Answered By: Jonah Brown   on Nov 03

I've looked at your problem in a little more detail... and given your
array of cash flows, I don't believe that it is possible to use the
IRR function to calculate a correct Internal Rate of Return. In
other words... it will always give you an error no matter what your
initial guess is set to. The correct IRR for this data is minus
138.5064%. Even if you use -1.38 as the initial guess the function
throws an error.

Below is some code that I wrote to test my theory. This uses linear
interpolation for successive approximations of the interest rate and
as such it is probably not as effecient as the IRR algorithm built
into Excel. But, unlike the complex calculus that math geeks use to
solve problems of this type, this method is less likely to chase down
the wrong root of a polynomial and it is more forgiving of a first
guess that is out of the ballpark.:-)

If this is a problem that some professor gave you to solve... I guess
it proves he has a sense of humor.


In the following code, step through it and watch the value of 'i'
and 'e2' change. As 'e2' approaches zero... 'i' gets more and more
accurate.

Sub Macro2()

Dim Guess As Double
Dim retrate As Double
Dim Values(5) As Double

Dim x1 As Double
Dim x2 As Double
Dim e1 As Double
Dim e2 As Double
Dim i As Double
Dim e3 As Double
Guess = -10
Values(0) = -70000#
Values(1) = 12000#
Values(2) = 15000#
Values(3) = 0#
Values(4) = 0#
' retrate = IRR(Values(), -1.38)
i = 0.1
x1 = i
e1 = Values(0) / (1 + i) ^ 0 + _
Values(1) / (1 + i) ^ 1 + _
Values(2) / (1 + i) ^ 2 + _
Values(3) / (1 + i) ^ 3 + _
Values(4) / (1 + i) ^ 4
i = i * 1.1
x2 = i
e2 = Values(0) / (1 + i) ^ 0 + _
Values(1) / (1 + i) ^ 1 + _
Values(2) / (1 + i) ^ 2 + _
Values(3) / (1 + i) ^ 3 + _
Values(4) / (1 + i) ^ 4
Do While Abs(e2) > 0.0000001
i = (e1 * x2 - e2 * x1) / (e1 - e2)
e1 = e2
x1 = x2
x2 = i
e2 = Values(0) / (1 + i) ^ 0 + _
Values(1) / (1 + i) ^ 1 + _
Values(2) / (1 + i) ^ 2 + _
Values(3) / (1 + i) ^ 3 + _
Values(4) / (1 + i) ^ 4
Loop
' on exit, 'i' will contain the correct value of interest rate
' as a final test... use the NPV function to double check the vlaue
of 'i'
e3 = NPV(i, Values())
End Sub

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Loop in formula Or get search suggestion and latest updates.


Tagged: