# Creating this in VBscript

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>

<title>New Page 2</title>

<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>

###### Who is Participating?

Commented:
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

Commented:
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 Commented:
That is what I usae in VBA
La = PV((rate * 0.01) / 12, term * 12, DP1 - (man + (tax / 12)))
0

Commented:
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

Commented:
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

0

Author Commented:
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 Commented:
Anyone
0

Author Commented:
No, and the language would be VBscript
0

Commented:
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 Commented:
No it isw not a school chrage.
0

Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.