Need IRR Function similar to Excel and VB for ASP
Posted on 2005-05-13
Hello all. I am trying to calculate an IRR function in an ASP page I have. I need to pass in 4 values and get back the internal rate of return as a %. For example in VB:
Dim Guess, RetRate, Values(4) As Double
Dim Fmt, Msg As String
Guess = 0.1 ' Guess starts at 10 percent.
Fmt = "#0.00" ' Define percentage format.
Values(0) = -2465399 ' Business start-up costs.
' Positive cash flows reflecting income for four successive years.
Values(1) = 1725956: Values(2) = 1686970
Values(3) = 1599299
RetRate = IRR(Values, Guess) * 100 ' Calculate internal rate.
Msg = "The internal rate of return for these four cash flows is "
Msg = Msg & Format(RetRate, CStr(Fmt)) & " percent."
MsgBox (Msg) ' Display internal return rate.
Gives me back 46.75
Any idea how I can complete this in ASP? Thanks all