Solved

EXCEL formula in ASP Classic

Posted on 2011-02-17
3
373 Views
Last Modified: 2012-05-11
Hello,

I have a formula in Excel which I would like to present online in a HTML form and then calculate the result in ASP Classic, however if someone has a way of doing it in Javascript that would be great as well.

This is the formula in Excel and potential values for each fields. The financial formulas result C14 is how much you will have to have saved up when you retire if you like to withdraw C14 each year if the interest is D14 over E14 years.

Result Field:
=C14*(1+D14%)*((1-(1/((1+D14%)^E14)))/D14%)

C14: (how much you want to withdraw each year)
10000

D14: (% interest each year)
5

E14: (how many years)
20


I have a form with three fields, one for C14, D14 and E14 which I will POST or GET depening on what you recommend.

Now my biggest problem is the ^ in ASP which I haven't been able to figure out and I'm probably getting a lot of the formula wrong anyways..

Appreciate any help.


0
Comment
Question by:SvassUK
  • 2
3 Comments
 
LVL 4

Expert Comment

by:Slim81
ID: 34918431
This is untested, I am testing it now....


dim C14, D14, E14, resultField

C14 = CDbl(request.form("C14"))
D14 = CDbl(request.form("D14"))
E14 = CDbl(request.form("E14"))

resultField = C14 * (1+(D14/100)) * ((1-(1/((1+(D14/100))Exp(E14))))/(D14/100))

Open in new window

0
 

Author Comment

by:SvassUK
ID: 34918604
Hi Slim81

Getting error for the code,

Expected ')'

/calculation.asp, line 20

resultField = C14 * (1+(D14/100)) * ((1-(1/((1+(D14/100))Exp(E14))))/(D14/100))
---------------------------------------------------------^

Open in new window

0
 
LVL 4

Accepted Solution

by:
Slim81 earned 500 total points
ID: 34918644
I was wrong with, you still use the Carrot for exponents....

Here is the code that I was able use:
<%
dim C14, D14, E14, resultField

'C14 = CDbl(request.form("C14"))
'D14 = CDbl(request.form("D14"))
'E14 = CDbl(request.form("E14"))

C14 = 10000
D14 = 5
E14 = 20

resultField = C14 * (1+(D14/100)) * ((1-(1/((1+(D14/100))^(E14))))/(D14/100))
%>

Open in new window


By using the Round(resultField, 2), the output was 130853.21

Let me know if you need further help or if I am way off base!

Thanks,
Slim
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now