IRR function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tinaw
    New Member
    • Sep 2007
    • 2

    #1

    IRR function

    Hi.

    I have a working APR quotation system that uses Excel, dialog boxes and some basic VB. I would like to streamline the process by transferring the IRR function into VB but I am a complete novice. The following information is provided by the user:
    loan (this is the first value used in the IRR function as a negative value)
    term (number of months)
    payments (these are the subsequent values used in the IRR function).
    In all cases the term will be between 12 and 300 and the payments will be the same each month.
    I picked up the following code from the Microsoft site but was wondering how I could adjust it to the example above.

    [CODE=vb]Sub TestIRR()
    Dim Guess, RetRate, Values(4) As Double
    Dim Fmt, Msg As String
    Guess = 0.1 ' Guess starts at 10 percent.
    Fmt = "#0.00" ' Define percentage format.
    Values(0) = -70000 ' Business start-up costs.
    ' Positive cash flows reflecting income for four successive years.
    Values(1) = 22000 : Values(2) = 25000
    Values(3) = 28000 : Values(4) = 31000
    RetRate = IRR(Values, Guess) * 100 ' Calculate internal rate.
    Msg = "The internal rate of return for these five cash flows is "
    Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
    MsgBox(Msg) ' Display internal return rate.
    End Sub[/CODE]

    Thanks for looking
    Tina xx
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    As far as I can tell, the IRR function works the same in Excel and VB6. What version of VB are you using, and what seems to be the problem?

    Comment

    • tinaw
      New Member
      • Sep 2007
      • 2

      #3
      I'm using VB 6.3. On the example shown each value is shown separately. As the values that I would be using are all the same and the time periods are usually very long (between 12 and 300), is there any way I can use a loop?
      Thanks for looking

      Comment

      Working...