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;

Similar Messages

  • How do I create a custom calculation script in a Adobe Acrobat XI form?

    I am building a time sheet.  Inside this time sheet i have two columns.  One column is labeled Hours and the other is labeled Hours Description.
    The fields are labeled under these columns as follows:
    Column Name      Hours          Hours Description
    Field Name          Hours1        HoursDesc1
    The user will input their hours in Numeric Field "Hours1" and will enter an abbreviation in Text Field "HoursDesc1", for example "A" for Administrative Leave or "C" for Compensatory.
    I want to build a script that if Text Field "HoursDesc1" equals "A" or "C" then display Numeric Field "Hours1", else equal 0.  If they enter anything other than "A" or "C", the result will be zero.
    Please help.
    Thank you.

    Custom calculation code for the text field in question:
    var desc = this.getField("HoursDesc1").value;
    if (desc=="A" || desc=="C")
         event.value = this.getField("Hours1").value;
    else event.value = 0;

  • I need someone to write a Java Script for my Adobe Acrobat form. I do not know how to write Java Code

    I have never worked with Java coding and am in need of assistance for an acrobat form I am working on.
         - I have a form with a field identifier called BACompnayName (this is the field where they would enter their company name).
         - I then have a form field with two radials that says "Is the shipping address the same as the business Address" - "Yes" and "No" (the form identified for this field is SASame.
    What I am trying to accomplish:
         - If they click yes, I would like the form to fill in the information found in BACompanyName otherwise, leave it blank to be filled out by the person filling out the form.
    I appreciate any help.
    Thanks,
    Brett

    Something like the following?
    Checkbox for &quot;make billing address the same as shipping address&quot; doesn't work (JavaScript)

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

  • How to convert a Excel file to a text file

    Hi,
    Anyone knows how to convert a excel file to a test file in java.
    Thanks
    John

    hi
    The question is not easy to respond. The easy way is to use the excel program itself! You can read the contents of an excel file using jdbc. Have a look at javaworld for an introduction (�It�s Excel-lent�). Another approach is to use a native library like JExcelApi. Have a look at http://www.andykhan.com/jexcelapi/index.html
    best regards
    benny

  • I want to convert this excel formula into a formula that works in Numbers =INDEX(Codes!$B$1:$B$9998;MATCH(TRUE;ISNUMBER(SEARCH(Codes!$A$1:$A$9998;'Curren t Account'!E4358));0))

    I want to convert this excel formula into Numbers formula =INDEX(Codes!$B$1:$B$9998;MATCH(TRUE;ISNUMBER(SEARCH(Codes!$A$1:$A$9998;'Curren t Account'!E4358));0))

    Without knowing the structure of the spreadsheet, or what e3xactly you are trying to do, it would be hard to advise. however, have a look here: http://help.apple.com/numbers/ipad/2.0/

  • Is it possible to use extensive formulas (e.g. "if" or vlookup functions) in the "Custom Calculation Script"?

    I am working on a form fill PDF converted from MS excel. This is for others to use who don't have MS excel that need to use my spreadsheet.
    1. I would like to know how complex can the formulas be in the custom calculation script in the calculate tab under properties in a cell menu?
    2. Where can I find what formulas will work in the custom calculation script along with the format for those formulas to work correctly (tutorials would help)?
    I have tried writing an "if" function but received and error so I am assuming either functions don't work in the script or there is a different format than standard spreadsheet formats.
    Bruce

    In that case the for loop would be:
        for (var i = 0; i < 8; i += 1) {
            sum += +getField("Total." + i).value;
    So initially, the counter i is equal to zero, so the field name used with the getField method is:
    "Total." + 0, which results in the string "Total.0". With each iteration, the variable i is incremented by 1, so the subsequent field names are the following:
    "Total.1"
    "Total.2"
    "Total.3"
    "Total.4"
    "Total.5"
    "Total.6"
    "Total.7"
    The script gets the value of each field, converts it to a number, and adds the number it to the running sum.

  • How do I create an "if" function in a custom calculation script?

    I need to take a simple "value is the sum of" and make it so if one field is less than 1 then the result of the formula will equal "0".
    For example here is a simple "sum of" script:
    Incent Bns.26, Time Bns.26, Spec Bns.26.
    Now converted to a custom calculation script:
    event.value = ((this.getField("Time Bns.26").value) + (this.getField("Incent Bns.26").value)) + (this.getField("Spec Bns.26").value);
    Where Time Bns is calculated by looking at another field Hours26 using a special formula to calculate the bonus.
    I would like to add something like an "if" function to the script so that if the Hours26 field is less than 1 then the output of the script will equal "0".
    I tried this already:
    var rank = this.getField("Hours26").value
    var value = 0
    if (rank < 1) {
      value = 0
    else  (rank > 0) {
       value = ((this.getField("Time Bns.26").value) + (this.getField("Incent Bns.26").value)) + (this.getField("Spec Bns.26").value);
    event.value = value
    But get the error: SyntaxError : missing ; before statement 7 at line 8:
    Thanks ahead of time for any help.
    Bruce

    Try this:
    var rank = this.getField("Hours26").value;
    var value = 0;
    if (rank < 1) {
      value = 0;
    } else {
       value = ((this.getField("Time Bns.26").value) + (this.getField("Incent Bns.26").value)) + (this.getField("Spec Bns.26").value);
    event.value = value;

  • How to convert an excel file where customers have partial access for selecting items.

    Please Advise,
    I have created an excel file with columns that calculates price and quantity. I need to know how my customers can access the file without seeing all my calculations, etc. and just select the number of items. I need to keep my excel formula info confidential and at the same time having the customers the ability to select the items.
    This excel file will be placed on my web site and linked where customers have access to it. They make their selections and emailed back for processing.with their selected items. If the excel file is converted into a pdf file, Then placed and linked for customer access how can customers have partial access and select in certain columns and have excel fuction for calculations?
    Thanks,
    Dan

    [discussion moved to Creating, Editing & Exporting PDFs forum]

  • How to convert an excel sheet as pdf  and sent mail?

    Hi,
    I have to open an excel file from report and display a value in a cell, based on that value in excel, macros will automatically trigger and the remaining data will fill in excel sheet.
    This sheet i need to convert as pdf and sent as attachment to mail.
    Regards,
    Shree

    Hi,
    I know how to do with word documents using OLE.  But i dont know how to work with Excel sheets.
    I have worked on word documents like displaying data in word document from SAP and saving it into local system.
    But here my requirement is i need to pass pernr to a cell in an Excel sheet, based on pernr in excel some macros will trigger and fill the details. After that, the filled sheet i need to convert as pdf and sent as mail.
    Regards,
    Shree.

  • 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 this BSO formulas into ASO formulas ?

    I need some help to convert this BSO formulas into ASO formulas:
    BSO formulas:
    12*("Head Count"->"Terminated"/((@PRIOR("Head Count"-> "Total Active & Leave")+"Head Count"->"Total Active & Leave")/2));
    "Head Count" is a member of the Account dimension
    "Terminated" and "Total Active & Leave" are members of the Status dimension
    Existing Active
    New Hire
    Active
    MAT
    STD
    OTH
    Leave
    Total Active & Leave
    Voluntary
    Involuntary
    Death
    Retirement
    End of Temp Assignment
    Terminated
    LTD
    Total Status
    Promotion Within Level
    Promotion to Higher Level
    Promotion
    No Total Status
    All Status
    Status (Dimension)
    In ASO, the formulas will be ??
    Thanks

    Try
    CASE WHEN IS([Period].CurrentMember, [Jan]) THEN
    12 * (([Head Count], [Terminated] ) /
    ((( [Head Count], [Total Active & Leave], [Dec], [Year].CurrentMember.lag(1) ) +
    ([Head Count], [Total Active & Leave])) / 2))
    ELSE
    12 * (([Head Count], [Terminated] ) /
    ((( [Head Count], [Total Active & Leave], [Time].CurrentMember.lag(1) ) +
    ([Head Count], [Total Active & Leave])) / 2))
    ENDTake note this assumes your Year dimension is in descending order
    Year
    --2007
    --2008
    --2009
    If Year is in Ascending order
    Year
    --2009
    --2008
    --2007
    Then you need to change
    [Year].CurrentMember.lag(1) to
    [Year].CurrentMember.lead(1)

  • Blank Page appears after converting MS Word (2010 on Win 7) document to PDF using Adobe Acrobat XI

    Hi,
    Even after updating to the latest version of Adobe Acrobat Pro XI (11.0.2). While converting a MS Word 2010 .docx format document to .pdf, the cover page with text, image and background color, appears blank with only the background color.
    Apperciate if someone can give me a resolution for this issue.
    Best Regards

    The coverpage gets converted in Acrobat.com cloud service. Is Abobe going to fix this bug in the Acrobat XI version too?

  • How to convert an excel "If" formula into a PCR?

    I need to create a rule so that an overpayment recovery is only taken if the net pay is above an agreed amount with the employee. I can write the rule in excel but i'm struggling to convert this into a PCR.
    All help is welcome even if it's pointing me to documentation to read.
    Example
    Agreed net pay with employee is 2,000 (I've created WT 4010 for this)
    If(net pay <= £2,000, overpayment not taken, If(net pay - overpayment > £2000, overpayment deduction taken, net pay - 2000 is the deduction
    Many thanks
    Richard

    Hi Richard,
    You may check the following syntax:
    Say, overpaymentrecovery wage type is 4020.
    Write the PCR for * 4010
      D AMT?2000
    >   ADDWT * ADDWT4020 --->>>net pay greater than 2000
    =   ADDWT *  -->do nothing to 4010
    <   ADDWT *  -->do nothing to 4010
    Now you have the overpayment recovery wage type in your IT with the same amount as 4010.
    You can revaluate it.
    e.g. if the recovery amount shall be 10% of the net payment.
    Write the PCR for * 4020
    AMT%10 ADDWT *
    Regards,
    Dilek
    Edited by: Dilek Ersoz on Feb 4, 2009 10:05 AM
    Edited by: Dilek Ersoz on Feb 4, 2009 10:06 AM

  • How do i insert excel formula in java code

    Hi frds,
    i want to insert formulas of excel in the excel spredsheet through java code
    eg
    if i want to insert =CONCATENATE(A2,B2) through java code how will i achieve this
    Regards
    JM

    Or [_JExcel_|http://jexcelapi.sourceforge.net/]
    To my knowledge JExcel is more complete and less buggy than POI.

Maybe you are looking for

  • Deployment exception while running a .jspx page in Jdev 11g 11.1.1.1.0

    I have a .jspx page that renders taskflows as dynamic regions. When I execute this exception is what I get. WARNING: [ComponentRule]{faces-config/component} Merge(oracle.adf.Table) <Aug 13, 2009 11:39:47 AM IST> <Warning> <HTTP> <BEA-101162> <User de

  • Tv series will not play in itunes

    Please can you tell me why a tv series that i purchased from itunes (Yes Priminister) will not play in itunes.  It was playing fine a couple of weeks ago.  I have checked i have the latest itunes and quicktime updates.

  • Imac freezes in sleep mode

    Ever since installing Lion my Imac freezes when in sleep mode. Has anyone had the same problem and been able to fix it

  • My Yahoo like Dynamic web page content creation

    Are there any methodologies/best practices available for creation of pages like My Yahoo. Basically, display of page depends on sections chosen by the user for display and inside those sections content is also what is chosen by the user. Page is diff

  • SmartView Error XML top level element

    Hi Guys, hopefully someone of you can help me with this issue. On some PCs(not all, but same OS and configuration) we get this error message when we are trying to connect to essbase with Smart View 9.1.3.5. The funny thing is we tried to document the