Copy link to clipboard
Copied
I am working on a form that has calculated 6 seperate domains. Each domain has a percentage weight that I need to calculate. It works for me in excel but don't know how to do a javascript for pdf.
| Grade | Weight | Score |
| 91 | 10% | 7.35 |
| 65 | 15% | 11.025 |
| 80 | 20% | 14.7 |
| 73 | 25% | 18.375 |
| 68 | 30% | 22.05 |
| 377 | ||
| 75.4 | 73.5 | |
| Average | Weighted |
Here is my formula for the 73.5 weighted calculation=SUMPRODUCT(A3:A7, B3:B7)/SUM(B3:B7)
I tried this script but it doesn't work
| =SUMPRODUCT(Rating_Domain_1+Rating_Domain_2+Rating_Domain_3+Rating_Domain_4+Rating_Domain_5+Rating_Domain_6, Score_1+Score_2+Score_3+Score_4+Score_5+Score_6)/SUM((Score_1+Score_2+Score_3+Score_4+Score_5+Score_6) |
Where Rating Domain = Grade and Weight = Score
Any help is appreciated.
Copy link to clipboard
Copied
Exactly where did you place this script?
It does not meet the coding requirements for using the Simplified Field Notation and does not use the statements needed by the custom JsvaScript option.
Have opened the Acrobat JavaScript console to see any syntax errors or other run time issues?
Copy link to clipboard
Copied
I tried both Simplified Field Notation and Custom but obviously I don't do javascript and hoping that someone could take my excel formula and create the javascript ![]()
Copy link to clipboard
Copied
Excel formulas are not JavaScript. Also Acrobat forms use field names and column and row ranges.
Many of the Excel functions do not exist in JavaScript so you either have to create a custom function or write the code to perform the function.
Adobe provides for free the Acrobat JS API Reference and other documentation about Acrobat JavaScript in the.be Acrobat Developer Connection at Adobe.com. The Mozilla Developer Network provides for free the JavaScript Reference. There are also numerous tutorials available through links on this site.
If you were to look at the calculation options and how they work, you would see it is possible to compute all the values you need using the "Field is the ______ of the following fields:". You can sum, multiply, and average which should be all of the operations you need.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more