Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

future formual for VB

Posted on 2001-06-15
7
Medium Priority
?
241 Views
Last Modified: 2010-05-02
How can I write a future amount formula in VB with the math formula being A(1+r)^(n-1)+A(1+r)^(n-2)+...+A(1+r)^0?
0
Comment
Question by:jennflock
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 3

Expert Comment

by:jrspano
ID: 6196559
this should do it

public function FA(r as long, a as long, n as long)

dim tempL as long
dim i as long
i = 1
do until n = i - 1
   templ = templ + (a * (1 + r)) ^ (n - I)
   i = i + 1
loop

end function
0
 
LVL 3

Expert Comment

by:jrspano
ID: 6196579
i forgot the line
fa = templ right before the end function
0
 
LVL 3

Expert Comment

by:leojl
ID: 6197778
hi..

I have done a lot of finance..roi programs.

just state in words what you wish to do.

also give a formula if you have a formula/equation

that you wish to solve on the computer.

leo
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 70

Accepted Solution

by:
Éric Moreau earned 200 total points
ID: 6198443
You can use the FV (future value) function. See this example (copied from the VB help):

Dim Fmt, Payment, APR, TotPmts, PayType, PVal, FVal
Const ENDPERIOD = 0, BEGINPERIOD = 1   ' When payments are made.
Fmt = "###,###,##0.00"   ' Define money format.
Payment = InputBox("How much do you plan to save each month?")
APR = InputBox("Enter the expected interest annual percentage rate.")
If APR > 1 Then APR = APR / 100   ' Ensure proper form.
TotPmts = InputBox("For how many months do you expect to save?")
PayType = MsgBox("Do you make payments at the end of month?", vbYesNo)
If PayType = vbNo Then PayType = BEGINPERIOD Else PayType = ENDPERIOD
PVal = InputBox("How much is in this savings account now?")
FVal = FV(APR / 12, TotPmts, -Payment, -PVal, PayType)
MsgBox "Your savings will be worth " & Format(FVal, Fmt) & "."

If not the correct formula, open the VB help for the FV function and see the "See also" link. You have plenty of financial functions alread alvailable.
0
 
LVL 3

Expert Comment

by:leojl
ID: 6199058
hi again jennflock,


in VB   FV = P * (1+r)^n

http://www.datachimp.com/articles/finworks/fmfutval.htm
this is a copy/paste from this link.

To find a formula for future value, we'll write P for your starting principal, and r for the rate of return expressed as a decimal. (So if the interest rate is 5%, r equals .05).
Your balance will grow according to the following schedule:


Year Balance
Now P
1 P + rP
2 (P + rP) + r(P + rP)

This starts to get messy in a hurry. But you can simplify it by noticing that you can keep pulling out factors of (1 + r) from each line. If you do that, the balances collapse to a simple pattern:


Year Balance
Now P
1 P(1 + r)
2 P(1 + r)2

If you follow this pattern out for n years, you get the general formula for future value:

1. FV = P(1 + r)n  

 
in VB   FV = P * (1+r)^n


 leo


0
 
LVL 49

Expert Comment

by:DanRollins
ID: 7136186
Hi jennflock@devx,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will suggest to:

    Accept emoreau's comment(s) as an answer.

jennflock@devx, if you think your question was not answered at all or if you need help, you can simply post a new comment here.  Community Support moderators will follow up.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Expert Comment

by:Computer101
ID: 7168568
Comment from expert accepted as answer

Computer101
E-E Moderator
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question