By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,529 Members | 864 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,529 IT Pros & Developers. It's quick & easy.

IRR function

P: 2
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.

Expand|Select|Wrap|Line Numbers
  1. Sub TestIRR()
  2.    Dim Guess, RetRate, Values(4) As Double
  3.    Dim Fmt, Msg As String
  4.    Guess = 0.1  ' Guess starts at 10 percent.
  5.    Fmt = "#0.00"   ' Define percentage format.
  6.    Values(0) = -70000   ' Business start-up costs.
  7.    ' Positive cash flows reflecting income for four successive years.
  8.    Values(1) = 22000 : Values(2) = 25000
  9.    Values(3) = 28000 : Values(4) = 31000
  10.    RetRate = IRR(Values, Guess) * 100   ' Calculate internal rate.
  11.    Msg = "The internal rate of return for these five cash flows is "
  12.    Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
  13.    MsgBox(Msg)    ' Display internal return rate.
  14. End Sub
Thanks for looking
Tina xx
Sep 11 '07 #1
Share this Question
Share on Google+
2 Replies


Expert 5K+
P: 8,434
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?
Sep 12 '07 #2

P: 2
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
Sep 17 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.