Results 1 to 4 of 4

Thread: Future Value of an Investment

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    Wisconsin
    Posts
    2

    Future Value of an Investment

    I am in need of VB code that will return the future value of simple investment. This is for Intro VB class assignment.

    Problem: Enter an Initial investment value in txtBox, have an hsb for years- The problem states "compound in years, not monthly" (not very practical, huh?), and an hsb for the intrest rate paid into the account. I can't find a VB function that doesn't use the " pmt" argument, and because no subsequent deposits or withdrawls are made to the account after the initial investment, I don't need a Pmt argument.
    When I use this Code- "fv(rate,nper,pmt,pv,type)" with "pmt" and "type" =0, I always get "0" returned as the Future Value.

    Does anyone know what I'm doing wrong?
    Thanks!
    SaintM

  2. #2
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391
    To be honest, I have never used the FV() function to compute the future value of an investment. I looked at the documentation and it appears that it's capable of doing much more than you're asking, but it will do what you're asking.

    I think your problem is that you need to set the pmt argument to 0 (you're not making any payments) and pass the present value to the optional pv argument. Leave the last argument, type, empty as it's optional.

    Another approach would be to derive the formula for computing present value, which is especially simple when you only have to compound the interest annually. You'll get the same result as with the VB function but I think it's more clear when you can see your own function work. Take a look (using FV(n) to represent the future value after n periods, and P to represent the initial amount of money you have in the bank:

    FV(1) = P*(1+r)
    FV(2) = FV(1)*(1+r) = P*(1+r)^2
    FV(3) = FV(2)*(1+r) = P*(1+r)^3
    . .
    . .
    . .
    FV(n) = P*(1+r)^n

    You can use that in VB by making a function:

    Function futureValue (r as double, yrs as Integer, P as double)

    'compute the future value of P after yrs years at a rate of r
    futureValue = P*(1+r)^yrs

  3. #3

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Location
    Wisconsin
    Posts
    2

    Future Value

    Thanks!

    I got it to work using both of your suggestions.
    You're right, it's easier to understand when I make a function.
    I appreciate the help!

    SaintM
    SaintM

  4. #4
    Hyperactive Member
    Join Date
    Mar 2002
    Location
    Boston, MA
    Posts
    391

    Smile

    No Problem :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width