Evaluation of excel formula to jsp/javascript

hi,
i am having one typical problem (this is returns on investment(ROI)based)i am having a formula in excel sheet that has to be implimented in jsp or java script. the inbuilt function in excel is NPV
NPV($F$11,H19:Q19)+G19(it is like this in my formula bar)
Syntax
NPV(rate,value1,value2, ...) even some formula is given in the help
can anybody help me how to calculate this using jsp/javascript and can give me the src code for this calculation.
thanks in advance
regards,
srikanth

Calculating the IRR is an iteration.
You try different interest rates until the NPV is as close
to 0 as you can get.
To calculate the IRR you will need the following:
(1) A starting point for the rate (the 'guess' argument in Excel)
(2) Your cash flows array (the 'values' argument in Excel)
You will also have to decide:
(3) How many attempts to make before giving up.
(4) How close to NPV = 0 is acceptable
(5) How to increment the interest rate
Now you make a loop.
Calculate the NPV.
If the NPV is > 0 try a higher rate.
If the NPV is < 0 try a lower rate.
If you are 'close enough' then return the rate.
If you have exceeded your maximum attempts then return
some value like 'not-a-number'

Similar Messages

  • Converting excel formulas to javascripts

    Hello, I am not experience in Excel formulas and creating "if" statements in Adobe Acrobat, so I'm hoping someone can help me with this. I have two problems.
    1.  Here is an excel formula that I need to convert over to javascripts. Can someone help with this?
    =IF(Q13>0,Q13+0,"")
    2.  Here is the second one,
    =IF(N16*Q16>0,((N16*Q16)+U16),"")
    In addition to these two formulas I need help with, the owner of the forms does not want the numbers to round up. Is there a way to get the exact answer and not rounding the numbers up in javascript?
    Thanks for your assistance.
    I have Adobe Acrobat X.

    Hi George, on the first script
    var Q13 = +getField("Q13").value;
      event.value = Q13 > 0 ? Q13, "";
    It comes up with a SyntaxError: missing : in conditional express 2: at line 3
    Do you know what that means and how to correct?
    Thanks
    Connie

  • Excell Formulas to Javascript

    I just got a request to convert an Excel file to PDF, and make the form calculate.  The calculations are pretty complex (at least to me they are).  There are four different types of formulas needed.  I've copied the information below.  Can someone help me with writing the scripts for PDF that would accomplish what the Excel formulas do?  I don't even know if it's possible to do and where to start.
    Thanks
    Connie Bretes
    Break Date:
    =IF(A20>0,$A$3+D20," ")
    If there is a tag number entered for the corresponding row, the equation will take the date cast and add the number of days until it's break, and give the date of the break. If no tag number (or any form of ID)
    is entered into the tag number cell, a blank cell will be shown.
    Correction Factor (C.F.):
    =IF(N20>0,LOOKUP('Correction Factor'!A3,'Correction Factor'!$C$3:$C$104,'Correction Factor'!$D$3:$D$104)," ")
    If there is a number entered in the corresponding Total Load cell, the equation will look up the correction factor value from the list in the correction factor tab based on the length and diameter ratio calculated in column A in the Correction Factor Tab, and give the proper correction factor.  If no total load value is given, a blank cell will be shown.
    P.S.I.
    =IF(N20>0,ROUND(((N20/(3.1415926535*((L20/2)^2)))*M20),-1)," ")
    If there is a number entered in the corresponding Total Load cell, the equation will solve (total load) / (pi * (diameter / 2)^2) to get PSI, and then multiply by the corresponding Correction factor to give it the appropriate PSI value.  The round function then rounds it to the nearest 10 value.  If no total load value is given, a blank cell will be shown.
    Average:
    =IF(N20>0,ROUND(AVERAGE(O20:O21),-1)," ")
    If there is a number entered in the corresponding Total Load cell, the equation will average the values of the 2 breaks for the cylinders cast for that day and round to the nearest 10 value. If no load value is given, a blank cell will be shown.

    First there is no direct conversion from Excel formulas to Acrobat's JavaScript. You need to know that even the simplified field notation and the field selection for some calculations both use JavaScript behind the scenes to perform the calculation.
    There is no easy date calculation like in Excel in JavaScript, you need to write custom JavaScript to convert the date string to a date object and then convert the date object to a date unit value and perform your calculation and then convert the result back to the date object for conversion to a string value. The format of the date strings is very important for these conversions.
    You also need to be aware that JavaScript's use of the IEEE floating point standard for decimal numbers introduces an error when using JavaScript's Math.round method so you need to create rounding function. JavaScript's Math.round method only works for integers.
    You might want to start with the tutorials at the http://acrobatusers.com/tutorials
    or www.pdfscripting.com

  • I need help converting an excel formula to javascript for a fillable form.

    Here is the scenario,
    If a person travels for 1 or 2 days we pay out a mealsrate of 75% per day. If 3 or more days we pay # days less 2 days * 25%. I hope that makes sense.
    V7 = Days, F14 = Mealsrate
    Formula in Excel
    =IF($V$7 = 1,$F$14*0.75,($V$7*$F$14)-(($F$14*0.25)*2))  and it works.
    I am VERY NEW to javascript (like yesterday) so don't laugh. I really have no idea what I am doing, but I was trying. Here is what i got. (by the way, It doesn't work)
    if(this.getField( ("Days").value=="1")){
    var f =this.getField("Mealsrate");
    event.value= f.value * .75;
    }else event.value = (Days * f.value)- (f.value *.25)*2;
    I appreciate all the help i can get.
    Tracie
    I'll be back on Monday, I hope I can find my post.

    OK, that Excel formula can be reduced a bit. The following custom Calculate scipt will do what the formula does:
    // Custom Calculate script
    (function () {
        // Get the inputs
        var days = getField("Days").value;
        var rate = getField("Mealsrate").value;
        // Set this field value
        if (days == 1) {
            event.value = 0.75 * rate;
        } else {
            event.value = (days - 0.5) * rate;
    It would make sense to add additional code to deal with negative numbers in either of the input fields.
    Edit: corrected a typo

  • How to convert an Excel Formula to a Custom Calculation Script in a Adobe Acrobat 9 Form?

    Hello,
    I am not familiar whatsoever with Javascript and need some help in converting the following Excel Formula so that I can enter it into a Custom Calculation Script in a Adobe PDF Form. Here is the formula:
    =IF(E15<25.01,9.95,IF(E15<50.01,11.95,IF(E15<75.01,13.95,IF(E15<100.01,16.95,IF(E15<150.01 ,19.95,IF(E15<200.01,24.95,IF(E15>200.00,E15*0.125)))))))
    Where "E15" will be the text field named "Subtotal" on my Adobe PDF Form.
    Thank you for any help you can provide!

    Fortunately JavaScript has the 'switch' statement so nested if statements can be avoided.
    var E15 = this.getField("Subtotal").value;
    switch(true) {
    case (E15 < 25.01) :
    event.value = 9.95;
    break;
    case (E15 < 50.01) :
    event.value = 11.95;
    break;
    case (E15 < 75.01) :
    event.value = 13.95;13
    break;
    case (E15 < 100.01) :
    event.value = 16.95;
    break;
    case (E15 < 150.01) :
    event.value = 19.95;
    break;
    case (E15 < 200.01) :
    event.value = 24.95;
    break;
    case (E15 > 200) :
    event.value = E15 * 0.125;
    break;
    default:
    event.value = "";
    break;
    } // end switch;

  • I would like to upload a excel file using jsp

    Hi,
    I would like to upload the excel file using jsp in my netbeans ide. Please help.
    I don Know what is the error in this jsp file. It is not showing any thing and the file is also not getting uploaded.
    Please gothru the code below.
    <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
    <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
    <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
    <%@ page import="java.io.*" errorPage="err.jsp"%>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <link href="<html:rewrite page="/design.css" />" rel="stylesheet" type="text/css">
    <title>Upload Page</title>
    </head>
    <body onKeyDown="DisablingBackFunctionality()" onLoad="DisablingBackFunctionality()">
    <html:form action="download" >
    <div style="position:absolute; left:100;top:200;">Select an excel File :<input type="file" name="uploadfile"></div>
    <div style="position:absolute; left:190;top:250;"><input type="submit" name="Submit" value="Read"></div>
    <div style="position:absolute; left:336;top:250;"><input type="reset" name="Reset" value="Clear"></div>
    mainmenu
    </html:form>
    </body>
    </html>
    <%
    String contentType = request.getContentType();
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
    DataInputStream in = new DataInputStream(request.getInputStream());
    int formDataLength = request.getContentLength();
    byte dataBytes[] = new byte[formDataLength];
    int byteRead = 0;
    int totalBytesRead = 0;
    while (totalBytesRead < formDataLength) {
    byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
    totalBytesRead += byteRead;
    String file = new String(dataBytes);
    //out.println("<br> file :"+file);
    String saveFile = file.substring(file.indexOf("filename=\"") + 10);
    //out.println("<br> savefile :"+saveFile);
    saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
    //out.println("<br> now file1 :"+saveFile);
    saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1, saveFile.indexOf("\""));
    //out.println("<br> now file2 :"+saveFile);
    //out.print(dataBytes);
    String ext = "";
    if (saveFile.indexOf(".") != -1) {
    ext = saveFile.substring(saveFile.lastIndexOf("."));
    int lastIndex = contentType.lastIndexOf("=");
    //out.println("<br>lst index of"+lastIndex);
    String boundary = contentType.substring(lastIndex + 1, contentType.length());
    //out.println("<br> boundary"+boundary);
    //out.println("<br> file :"+file);
    int pos;
    pos = file.indexOf("filename=\"");
    //out.println("<br> now 0 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 1 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 2 :"+pos);
    pos = file.indexOf("\n", pos) + 1;
    //out.println("<br>now 3"+pos);
    int boundaryLocation = file.indexOf(boundary, pos) - 4;
    int startPos = ((file.substring(0, pos)).getBytes()).length;
    int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
    FileOutputStream fileOut = new FileOutputStream("D:\\" + saveFile);
    //FileOutputStream fileOut = new FileOutputStream(saveFile);
    //fileOut.write(dataBytes);
    fileOut.write(dataBytes, startPos, (endPos - startPos));
    fileOut.flush();
    fileOut.close();
    session.setAttribute("fil", saveFile);
    //out.println("File saved as " +saveFile);
    %>
    <script type="text/javascript" >
    function DisablingBackFunctionality()
    var URL;
    var i ;
    var QryStrValue;
    URL=window.location.href ;
    i=URL.indexOf("?");
    QryStrValue=URL.substring(i+1);
    if (QryStrValue!='X')
    window.location=URL + "?X";
    </script>
    Please let me know the result as soon as possible. Its my very urgent.
    Thanking Yu,
    Muthu Kumar.R

    No.
    Mylenium

  • How Can i do a excel graphic with jsp?

    have to create an excel graph in jsp taken there values of a database.
    thanks a lot,
    Federico.

    "is used to spawn Excel from a JSP page, from the output of a HTML table but i dont know how (or if you can) to manipulate Excel through java so that you can get a chart."
    Let me rephrase this hehe =P
    You create an HTML table from the data you pull from the database. You then use the setContentType
    <%
    response.setContentType("application/vnd.ms-excel");
    %>
    this is to tell the browser it should look for Excel on the client machine, to dispay the output.
    Again i hope this helps even a little =)

  • Read an excel file using JSP in MII 12.1

    Hi,
    I want to read an excel file using jsp page. I dont want to use the UDS or ODBC for connecting to excel.
    I am trying to use org.apache.poi to read the excel file in jsp page.
    While running, its showing a compilation error "package org.apache.poi.hssf.usermodel does not exist"
    I have the jar files for it, where do we need to upload it so that jsp page works.
    Thanks a lot
    Regards,
    Neha Maheshwari

    The user doesn't want to save the excel file in server.
    I want to upload file and save its contents in database.
    I have the code to read and save excel data in database but not able to get the location to deploy the jar file.
    In general, if we are creating a jsp page in MII workbench which is using some jar file.
    Whats the location to upload this jar file so that the jsp page works correctly?

  • How to use Excell formula's within EVDRE

    Hi,
    we want to built a rather large P&L with time in columns and account and cost center in the rows.
    We would like to insert some subtotals within the P&L strucure using simple excel formula's.
    So we create the P&L structure and leave some empty rows in between, which are filled up with excell formula's. The row key range is adapted, so it does not reference the excell formula's. If we hit refresh workbook, our P&L is ready and displaying the correct data.
    Problem now is if we select 'expand all'. My entire P&L structure is changed and displayes the last section of the row key range several times (as many as we have different row key ranges) ... I've put "noexpand" on all of the dimensions on row and column ...
    So normally does one use the functionality of excell formula's within a EVDRE report?
    D
    solved it

    Hi D
    One way is to switch of the expansions and insert the rows and then have the subtotals. to swith of expansion just edit the cell where you have written the evdre function and then remove the formulas pointing to expand range.
    EVSUB in after range would not work here as the whole range is related to one dimension and it works if we have two dimensions and need subtotals
    Regards
    Harish B K

  • SAP BPC 10.0 NW - Delete excel formulas

    Hello Experts,
    I have both "Keep formula on data" chekboxes selected (inside Edit Report and inside Sheet Options) and in my computer when I refresh the workbook the formulas are not deleted, but in other computers, also with the same version of EPM add-in the formulas are deleted.
    Any ideas?
    Thanks,
    Nadine

    Hello Guys,
    I've tried to put the last 2 options selected as you said Nilanjan but no results.
    Rohit, the report is static. I've created the report with Insert new member functionality and so the values of some cells are coming from input forms and others are just excel formulas. When I open the report in my computer everything works, when I try to open it in other computers the Excel formulas are deleted...
    Do you have any ideia of what is happening?
    Thanks in advance,
    Nadine

  • Numbers Equivalent of Excel Formula for Converting HH:MM:SS to DD:HH:MM:SS

    I am not sure if this has been asked before.
    What would be the Numbers formula for converting HH:MM:SS to DD:HH:MM:SS?  The Excel formula is entering 396:59:45 into a cell and then in another cell is the following =TEXT(A2,"dd:hh:mm:ss").  The A2 is the example cell.

    There is no formula to actually do the conversion. It is a matter setting the cell format. After that all you need to do is add a simple =<cell> formula to get the value in (i.e. - see my previous post), or a formula to add the two values (=A2+A5). Use Duration rather then Time for the cell formats.
    A duration in Numbers for iOS will not appear 10:16:25:03, it will display as 10d 16h 25m 03s. If it is the actual display punctuation you are trying to change, it may be possible using a combination of a Duration and TEXT functions but would be quite lengthy, convoluted, and more trouble than it is worth.

  • Use of Excel Formulas in EVDRE reports

    Dear Freinds,
    I am trying to use excel formulas in EVDER (report).
                                                      2011.MAR
    Account(Base level member)  =SUM(RANGE)
    this at somepaces is working and in some places its  not working. Kindly share the knowldge how to use them in excel

    Hi Vishwanath,
    Whenever we expandan EVDRE report or Input schedule, the formula (if any) in the first cell is applied to the to the other cells as well. Thus in expansion we will loose any formula specified in the other cells.
    If you donot want this to happen, it is better to make the evdre static. This should help you use formulae as required.
    Hope this helps.
    Regards,
    Shoba

  • EvDRE - SortRange - AfterRange - Copy Excel formula

    Hi all,
    In BPC NW 7.5 SP04 I have performed the following actions:
    I have sorted the EvDRE based on some column and added an AfterRange parameter.
    In the AfterRange cells I have entered various Excel formulas as well as evsub.
    The system would copy the Excel formulas to the line with the EV_AFTER and the copy was like standard Excel.
    e.g. - In the AfterRange I would specify cell B2. in B2 I would write the formula A1B1.
    When the EvDRE would run, assume that the after range had to be in cell E16, The value of E16 would be the result of the formula D15+E15.
    This year we have upgraded to SP06. This functionality stopped working. I tackle 2 situations:
    1. If the cell is defined in general format - the system simply copies the result of the formula. In the example above if A1+B1 is 0, I would simply get 0 all over (copy the value and not the formula).
    2. If the cell is defined as TEXT in Excel, the original formula is copied (i.e. in the example above all cells would have the formula A1+B1).
    evsub works as it should.
    Any idea why did this happen? is there a note? does the system now works as it should and I simply enjoyed a bug in SP04?
    Thanks,
    Avihay

    Hi Ethan,
    I have Accounts in Rows and Time in columns. Range E24:E26 is in AfterRange filed on column expansion. 'E24:E26' range adds prior 2 time columns. I want to display this summation on a particular condition, say only if cell D11 = 1. So I wrote a formula in AfterRange field in Column expansion: =IF(D11=1,"E24:E26","") .
    This formula in AfterRage field doesn't work. But if I manually type value 'E24:E26' in that field, it correctly adds up prious 2 time periods. I think the issue is with formatting.
    Thanks, John

  • Retrieving BEx Query Results Area for use in Excel formulas

    Hello,
    I run BEx queries in workbooks and then use Excel formulas ( mostly VLOOKUP(LookupValue, ResultsArea, ColumnReturned,) ) to retrieve certain information from the query ResultsArea.
    ****Problem:
    Depending on the query parameters, the query "Results Area" is larger or smaller.
    ****Non-optimal solution:
    One way to define the  ever changing Excel range occupied by the Results Area is to create an Excel name as:
    QueryRange = OFFSET(QueryFirstCell,,,COUNTA(OFFSET(Sheet1!$A:$A,,COLUMN(QueryFirstCell)-1,,)),COUNTA(OFFSET(Sheet1!$1:$1,ROW(QueryFirstCell)-1,,,)))
    Then, the only input required is the top-left cell of the Results Area, which stays the same (unless the query definition changes).
    ****Question
    What is the best way to refer to an ever-changing query Results Area in an Excel formula?
    Thank you!
    Louis

    It is actually much easier than that.
    Use a VBA statement like the following:
    Set RptRng = ActiveCell.CurrentRegion
    This will retrieve the data in the Results Area, no matter what the size is.
    Hope this helps...
    Bob

  • How do you display excel formulas?

    How do you display EXCEL formulas in Numbers once imported?

    select the cell and look at the bottom of the window or doubel click the cell:
    after double clicking cell:

Maybe you are looking for

  • How to see a query?

    I get the following message when I try to delete a row using BC4J and JSP: Error Message: JBO-26080: Error while selecting entity for GenesisSalesGroup Error Message: ORA-00936: missing expression I've added a transient column to an entity class. Bes

  • 64 bit noob wants a 32 bit app... [SOLVED...for now!]

    I got the following when trying to install Google Earth: Uncompressing Google Earth for GNU/Linux 5.1.3533.1731............................................................... ./setup.sh: line 216: setup.data/bin/Linux/amd64/setup.gtk2: No such file o

  • How to avoid system standby programmatically?

    Hi all, I implemented an application that uses NSThread to transfer pictures from a digital camera. The process might take long so I would like to ensure that the Mac won't go to sleep during the transfer. I have three questions: 1). Is it actually p

  • Adding Cell in a row in Smart Form

    Hi All, Can anybody please tell how to add a cell in the row of a table in smart forms. Thanks

  • Reset Password email:  subject line and body

    For an email that is sent from this page: Home>Manage Workspaces>Manage Developers and Users>Reset Password Question: Where/how can I change the subject line and message-body contents for this email