Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Creating this in VBscript

Posted on 2004-04-11
11
Medium Priority
?
472 Views
Last Modified: 2009-12-16
IF someone could be nice enough. I need a calculator made in VBscript that can calculate the amount of a loan a payment can take.


For example, if you can pay for a mortgage $850.00US a month with a 30 year 7.5% interest rate your loan should be the amount of $107,263.22

So I need a formula that can find out how far a payment can go for a loan  (like the above example) but from there I need to subtract condo fees, PMI, and monthly taxes and then determine the amount of the loan.

Below I pasted my html code so the experts can take a look at it.

<html>

<head>
<title>New Page 2</title>
</head>

<body>

<form method="POST" action="--WEBBOT-SELF--">
<!--webbot bot="SaveResults" U-File="file:///C:/My Documents/My Webs/_private/form_results.csv" S-Format="TEXT/CSV" S-Label-Fields="TRUE" --><table border="1" cellpadding="2" style="border-collapse: collapse" bordercolor="#111111" width="759">
<tr>
<td width="50%" colspan="2">
<p align="center">Input Information </td>
<td width="50%" colspan="2">
<p align="center">Out put Information </td>
</tr>
<tr>
<td width="25%">
<p align="right">Term of the loan:</td>
<td width="25%"><input type="text" name="T1" size="20"></td>
<td width="25%">
<p align="right">Monthly Payment on Loan:</td>
<td width="25%"><input type="text" name="T8" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Interest Rate:</td>
<td width="25%"><input type="text" name="T2" size="20"></td>
<td width="25%">
<p align="right">Monthly Taxes:</td>
<td width="25%"><input type="text" name="T9" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Yearly tax:</td>
<td width="25%"><input type="text" name="T3" size="20"></td>
<td width="25%">
<p align="right">Monthly Condo Fees:</td>
<td width="25%"><input type="text" name="T10" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Monthly Condo fees:</td>
<td width="25%"><input type="text" name="T4" size="20"></td>
<td width="25%">
<p align="right">PMI Payments:</td>
<td width="25%"><input type="text" name="T11" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">PMI Payments:</td>
<td width="25%"><input type="text" name="T7" size="20"></td>
<td width="25%" bgcolor="#FF9999">
<p align="right">Total monthly Payment:</td>
<td width="25%" bgcolor="#FF9999"><input type="text" name="T12" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Down Payment:</td>
<td width="25%"><input type="text" name="T13" size="20"></td>
<td width="25%">
<p align="right">Loan Amount:</td>
<td width="25%"><input type="text" name="T14" size="20"></td>
</tr>
<tr>
<td width="25%">
<p align="right">Desirable payment:</td>
<td width="25%"><input type="text" name="T6" size="20"></td>
<td width="25%">
<p align="right">Property Amount:</td>
<td width="25%"><input type="text" name="T15" size="20"></td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
<td width="25%">&nbsp;</td>
</tr>
<tr>
<td width="25%">&nbsp;</td>
<td width="50%" colspan="2">
<p align="center"><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></td>
<td width="25%">&nbsp;</td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</form>

</body>

</html>

0
Comment
Question by:eteran
[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
  • 5
  • 5
11 Comments
 
LVL 2

Expert Comment

by:rqs
ID: 10803653
Correct me if I am wrong, but it seems that aside from requesting for a vbscript
to calculate how far a payment can go for a loan, you also request the experts to suggest
a formula for calculating this value given monthly mortgage?

If I am wrong, then please post the formula for making the computations, as it
would be easier to map that logic into a VBscript function.
0
 

Author Comment

by:eteran
ID: 10809472
That is what I usae in VBA
La = PV((rate * 0.01) / 12, term * 12, DP1 - (man + (tax / 12)))
0
 
LVL 2

Expert Comment

by:rqs
ID: 10809673
Ok, you have VBA code for computing the value already.
That would be quick to translate to VBScript.

However, from the line of code you posted, the logic for computing
the loanable amount is still hidden in the function PV,
the parameters of which are:
a) (rate *0.001)/12   --> (i.e rate = 7.5%)
b) term *12              --> (i.e. term = 30 years)
c) DP1 - (man + (tax/12))               --->(what does DP1 stand for, downpayment 1?
--> (so this is monthly amortization amount, like $ 850.00)
-->
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:rqs
ID: 10809769
Ok, you have VBA code for computing the value already. That can be translated for use in VBScript.
However, from the line of code you posted, the logic for computing the loanable amount is still hidden
in the function PV. Please also post the code of this function.

Regarding the parameters of PV, i have some clarifications:
a) (rate *0.001)/12   --> (i.e rate = 7.5%)
b) term *12              --> (i.e. term = 30 years)
c) DP1 - (man + (tax/12))               -->(what does 'DP1' stand for, downpayment 1 or desirable payment?
                                                    -->(so 'man' stands for monthly amortization amount, like $ 850.00)
                                                    -->('tax' isn't the tax rate, right? it's the amount in dollars of tax to be paid every year?)

you mentioned about condo fees, PMI and monthly taxes. How do those get into the picture? They don't seem to
be integrated with the call to the function PV. From your HTML form my guess is they're simply added together
with the monthly loan payment (to get an idea of wether the applicant can actually pay considering other
fees he has to pay monthly).

If you can give me a clearer idea of the flow and processing of data on the HTML form, I believe I
can help you with this.





0
 

Author Comment

by:eteran
ID: 10809797
Here is a link to how PV works. I hope it can help.
Also, About the PMI. if you download the Html I pasted you will see the PMI and condo fee info.
So lets say someone tells you I can only pay $1,200.00 for my condo... From there I would have to deduct the condo fees, PMI and  taxes. Let say con fee where 150 and taxes 100 and PMI 60 then the amoiunt that would go into the PV would be  $890.00 for just my loan. I hope this helps and thanks guys.

http://vms.cc.wmich.edu/~harikb/econ319/319CHAP06/sld017.htm
0
 

Author Comment

by:eteran
ID: 10820138
Anyone
0
 
LVL 6

Accepted Solution

by:
DominicCronin earned 1500 total points
ID: 10826472
Do you have Excel on the machine in question? If so, it's fairly simple to write a VBS that uses Excel to do the heavy lifting. Heck - the only reason anyone would write this sort of calculation in "longhand" is if it's been handed out as a college assignment.
0
 

Author Comment

by:eteran
ID: 10829013
No, and the language would be VBscript
0
 
LVL 2

Expert Comment

by:rqs
ID: 10829039
Hi eteran,
Hmmmm.... I checked on the link you gave, they appear to be lecture notes. I hope it's not indeed an assignment.
Please be reminded that Experts are not allowed to answer assigments for students.

However, if you had already done this sort of program in VBA or VB in another application, and just
wish to create an online version (perhaps to allow agent to access the loan calculator from the web and save it
to a central database, for whatever purposes), it would not be that complex a problem. The Experts can guide you
on how to do the "translation" of your existing code to VBScript so that it will work with a web browser.
0
 

Author Comment

by:eteran
ID: 10838061
No it isw not a school chrage.
0
 
LVL 2

Expert Comment

by:rqs
ID: 10857011
Hi eteran,

I hope you don't mind me asking. You accepted DominicCronin which was an Excel/VBS solution
when in the first place, what you have stated to be seeking is a VBScript/HTML solution?
Ofcourse, that path would be an easy alternative if the only objective was simply
how to find a way to automatically compute your PV values.




0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Six Sigma Control Plans
Progress

610 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