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

Similar Messages

  • 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

  • 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

  • Converting Excel formulas in Numbers

    I am new to Numbers and have an Excel Spreadsheet that I've used previously that calculates the best 4 scores from golfers over a 10 week period. In Excel I used =sum(LARGE[e2:n2,{1,2,3,4}]) but when I use it in Numbers I get a Syntax Error message. Is there anyone who can help me convert the Excel formula so that it works in Numbers.

    Numbers does not use excels array functions so this will probably work:
    =SUM(LARGE(E2:N2, 1), LARGE(E2:N2, 2), LARGE(E2:N2, 3), LARGE(E2:N2, 4))

  • Converting Excel formulas to use in Numbers

    I want to use an Excel 2010 spreadsheet in Numbers on my iPad.
    When added and opened with Numbers, some formulas are not copied, only the values... How can I keep / convert all the the formulas ?

    Hello pjl123, and thanks for helping
    Only some formulas are not converted. It's a bit long to find all of them, because there seem to be a lot of small triangles with exclamation points in the converted Numbers file.
    I'm not sure about the way I should save the file, since I presently use Excel 2010 normally (.xls format)
    The reason I'm asking for help on this, is that I want to get rid of my M/S windows laptop in favour of an Apple, and I have a lot of excel files that would require a lot of work to redo in numbers....
    If anyone knows how to save an excel file in a format more compatible with numbers, I would be very grateful.

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

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

  • Convert mathematical formulat to excel formula

    I have a formula that was generated by excel when using a trendline on a graph. I need to convert this formula into an excel formula I can use again.
    the formula is below. Assume that the value for X will be in Cell A1. Any help converting this to an excel formula would be awesome. FYI = for a X value of 20,000, the formula should output something close enough to 20,000 ( +- 5 or 10k).
    y = 1.8932x6
    - 116.85x5 + 2669.5x4
    - 27947x3 + 140531x2
    - 298100x + 199955

    Test the result according to the formular that you provide initially and get the result 16993.54 (B2=1) which it is should be.
    =1.8932*B2^6 -116.85*B2^5 +2669.5*B2^4-27947*B2^3+140531*B2^2-298100*B2+199955
    (The fomular you provide last time is different from your initial request.)
    Cheers,
    Tony Chen
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please contact
    [email protected]

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

  • What is the use of 'Convert to Formula' in BEx Report?

    Helo BI Gurus,
    After refreshing the query in BI, when I right click on the query report, I am getting an option 'Convert to Formula'. Can you please tell me the use of this option, and how we can use this in our report and what the result we will be getting?

    Hi Mathew,
        The Convert to Formula in Excel Allows you to Convert you Embedded Bex Query into API Calls. This enables you to Better Format the Excel Output by allowing you to move your Cells Around.
    This helps because when you refresh you Query all the Changes you make will be maintained.
    [More Info on Working with Formula|http://help.sap.com/saphelp_nw70/helpdata/EN/d3/015369f54f4a0ca19b28c1b45acf00/content.htm]
    Hope this Helps
    Datta.

  • BEx Analyzer - Convert to formula - Dynamics of a hierarchy

    Hi BI-Experts,
    I have a question regarding the BEx Analyzer built in functionality "convert to formula".
    Once I have done this, the report is more ore less static, establishing a fixed link between the cell and the query result.
    (BExGetData(u201CDATA_PROVIDER_1u201D,F8,E10)
    Let's say I had included a G/L account hierarchy and converted the analysis grid item to formulas: I will lose drill down functionality of the hierarchy, drag & drop etc.. I can live with that.
    But what happens, if I update the G/L hierarchy in BI by uploading from ECC and someone added an additional text node and 3 new G/L accounts. They won't appear in my "convert to formula" report, even when refreshing, right?
    Does anyone know a work-around for a highly formatted report in BEx Analyzer which keeps the layout when refreshed (only way I know is with "convert to formula") AND using hierarchies which should be able being updated?
    Every hint is much appreciated!
    Kind Regards,
    Steffen Lange

    >
    Steffen Lange wrote:
    >
    > But what happens, if I update the G/L hierarchy in BI by uploading from ECC and someone added an additional text node and 3 new G/L accounts. They won't appear in my "convert to formula" report, even when refreshing, right?
    >
    > Kind Regards,
    > Steffen Lange
    Thats right, as now the key figure values are basic excel formulas though they refer your dataprovider.
    The only option is to update the value of the hierarchy (new nodes etc) in the workbook too, you can add a new row and insert the new hierarchy value it should pick it up and key figures populated accordingly (you may need to put right row column value for your key figure calculation formula).
    Edited by: Praveen G on Aug 12, 2009 3:54 PM

  • What is the use of 'Convert to Formula' option available BEx Query Rpt?

    After refreshing the query in BI, when I right click on the query report, I am getting an option 'Convert to Formula'. Can you please tell me the use of this option, and how we can use this in our report.
    1) What does "convert to formula" do?
    2) After I click on "converting to formula" in the report , I am unable to paste the spreadsheet from i finance into excel. Below msg appears. What settings do I need to change?
    " Microsoft Office Excel cannot paste the data"

    Can anyone help me to get answers for the below questions

  • Convert to formula

    Hello all
    Ib bex Analyzer, there is the option of "Convert to Formula". what is the main options and advanteges of this appliction?
    B.R
    Yuval

    Hi,
    Im not that pretty sure about the usage of this.
    But what I have observed is that:
    1) 'Convert to Formula' converts your input ready layouts into a normal Excel layout.
    2)The input readiness is lost once you convert it into formula.
    3)All the compounded characteristcs are removed from the layout.
    4) If a Key Figures of type % is initially displayed as 70%, then after converting it to Formula, it displays as 70.
    For Eg: If keyfigures for Amounts were displayed as 200INR, $100 initially, then once you click on Convert to Formula, the KFs are displayed now as 200,100 and you can do the normal Excel functionalities now like Sum, Min, Max, Average, Count ,etc.
    The result rows will be displayed now irrespective of the currencies / units in rows. ie: 200, 100 , the sum is displayed as 300.
    Best Rgds
    Shyam

  • BI 7.0 Bex Analyzer Workbook - Convert to formula function features

    Hello,
    when using the convert to formula function in a BI 7.0 Bex Analyzer Workbook (WB)  the result area becomes completely static.
    1.) Is there a possibility to add drill downs / across into an already converted to formula WB?
    2.) I inserted drop down boxes to allow F4 like selections, however those are pointless if several characteristics are being used i.e. the keyfigure results get blanked out. Is there another way to do this at all?
    3.) Could someone provide me with a real live example / whitepaper how the convert to formula function can be used?
    Many thanks for any feedback on this.
    Regards
    Christian

    >
    ChrisAC wrote:
    >
    > 3.) Could someone provide me with a real live example / whitepaper how the convert to formula function can be used?
    >
    > Many thanks for any feedback on this.
    >
    > Regards
    >
    > Christian
    It does become static and all the workbook gets all the excel property.
    The key figures are now calulated on the basis of your data provider from the server as a formula in each cell..
    I had used to populate my key figure only for the required values of a characteristic.

  • Oracle BI Publisher Java API Converting Excel(.xls) to PDF

    Dear Oracle Team,
    I'm suffering from converting Excel(.xls) to PDF file which Excel is having some complex Pie charts and formulas.
    I've worked on some APIs but not converting properly, Please suggest me any Java API's in Oracle BI Publisher and provide me some code snippet
    Thanks in advance

    Hi,
    Can any one please reply to my post

Maybe you are looking for

  • MacBook Air mid 2013 built-in keyboard trackpad

    I need help! Upon a fresh install of osx 10.8.5 on my MBA mid 2013 my built-in keyboard and trackpad do not work. If I boot into recovery they work! But once I boot to my desktop at the login screen I can't control anything.  I've tried repairing per

  • Using general hierarchy of sales information system

    Hi, The sales manager uses oftenly the general hierarchy in order to sort the information that could extract from sales information system. So, firstly he uses the tranasction MCK1 to create a hierarchy and after that he executes the transaction MCSI

  • Palm TX Resets when pushing Hotsync

    I'm posting this for my father. He has a Palm TX syncing with Windows Vista. When he tries to hotsync via USB the Palm device does a soft reset and thats it. I tried syncing it over the wireless network and when I push hotsync on the device it does t

  • Urxvt , copy/paste from openbox

    Did my homework and found select -> copy middle -> paste, but it seems like urxvt have its own clipboard and openbox have another, I can't copy something from urxvt and paste it to firefox. Is there a fix for this?

  • My choice of plugin to open files will not respond automatically

    When I try to open a downloaded file, I always have to find and choose the plugin. I have hecked the "always use this ..." in preferences.