Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.

# Thread: Excel fomula conversion for PDF form

1. ## Excel fomula conversion for PDF form

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

• 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

• ## Users who have thanked Philip M for this post:

Tim R (03-09-2012)

• 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

•

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•