Quick VBScript Question

Results 1 to 2 of 2

Thread: Quick VBScript Question

  1. #1
    Join Date
    Dec 1969

    Default Quick VBScript Question

    Is there anywhere to download code for financial functions in VBScript (FV, Rate ...)? The same ones that come with VB. Or maybe an object with these functions? <BR>Thanks.

  2. #2
    Join Date
    Dec 1969

    Default A good question!

    No, I haven&#039;t seen one.<BR><BR>But they aren&#039;t hard to write.<BR><BR>For example, the basic formula for a loan with regular monthly payments is:<BR><BR>LoanAmount = PaymentAmount * ( 1 - ( 1 + MonthlyInterestRate) ^ -NumberOfMonths ) / MonthlyInterestRate )<BR><BR>where the interest rate is expressed as a decimal, not a percent, of course.<BR><BR>And a little simple algebra means you can go the other way:<BR><BR>PaymentAmount = LoanAmount / ( 1 - ( 1 + MonthlyInterestRate) ^ -NumberOfMonths ) / MonthlyInterestRate )<BR><BR>There is no formula possible for getting the interest rate given the other three values; you simply have to use an iterative algorithm where you try too-high and too-low values until you converge on (or actually very near) a right answer.<BR><BR>Finally, if you know the other three and want the number of months, that one does involve a bit of trickier algebra. If you care, I *think* it is:<BR><BR>temp = 1 / ( 1 - (LoanAmount * MonthlyInterestRate / PaymentAmount ) )<BR>NumberOfMonths = Log( temp ) / (12 * Log( 1 + MonthlyInterestRate ) )<BR><BR>If those don&#039;t work, tell me and I&#039;ll whip up a demo page to see what I did wrong.<BR><BR>

Posting Permissions

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