...

View Full Version : Excel fomula conversion for PDF form



Tim R
03-09-2012, 05:42 PM
Hello everyone,
'recently converted an excel timesheet to a PDF form. Trying to get some help to convert two excel formulas (formulae?) into javascript.
First Excel formula is intended to return the value of "40" if the total is above 40, otherwise display actual value: =IF(L17>40, 40,L17)
Second excel formula is the "overtime" field, which displays the number of hrs above 40hrs, or displays "N/A" if below 40: =IF(L17>40, L17-40, "N/A")
I have essentially no experience in Javascript and I am trying to learn, but any help to get me over this hump will be appreciated.
Regards
tim

Philip M
03-09-2012, 06:01 PM
IF(L17>40, 40,L17)
becomes
if (L17 > 40) {L17 = 40} // if not L17 retains its existing value;


IF(L17>40, L17-40, "N/A")
becomes
if (L17 > 40) {L17 = L17-40}
else {L17 = "N/A"}


Quizmaster: In which century was Coca Cola invented?
Contestant: The eighteenth

Tim R
03-09-2012, 07:01 PM
Hello Philip,
Thank you so much for the quick reply. I realized that I missed an important piece of information in my summary. In my excel file, the value which is subjected to the first formula comes from cell L17, but the result is displayed in cell G20. Similarly, the result for formula 2 is displayed in cell G21.
With this in mind I believe I would need to put the javascript code in the equivalent "target" field of the PDF, but when I do that, nothing seems to happen when I simulate data entry. Do I need to somehow reference the target field in the code, where the resultant value will be displayed?
Thanks again for any insight
regards
tim



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum