Create a Rate Calculation in an Adobe Acrobat PDF Form
Question details
Create a calculated Rate field in a fillable PDF using the Total and Hours fields.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form needs to calculate Rate as Total multiplied by 200,000 and divided by Hours.
- Observed behavior
- The Rate field should update from the entered values and remain blank when Hours is zero or empty.
Open the fillable PDF in an Acrobat version that can edit forms, such as Acrobat Pro. Check the exact field names in Prepare a form; the script must match them.
Add a custom calculation script to the Rate field
Use this method to calculate the rate automatically while preventing division by zero.
In Acrobat, open the PDF and select All tools > Prepare a form.
Select the Total and Hours fields and check their names in Properties. Also identify the field that will display the Rate.
Double-click the Rate field, select the Calculate tab, and choose Custom calculation script. Click Edit.
In the JavaScript editor, enter: var total = Number(this.getField("Total").value); var hours = Number(this.getField("Hours").value); event.value = hours ? (total * 200000 / hours) : ""; Replace Total and Hours with the exact names of your form fields, then save the script and close the properties.
Exit form editing or select Preview, enter values in Total and Hours, and check the Rate. Test Hours as zero and blank; Rate should be blank in both cases. Save the PDF.

Work with PDFs and office documents in WPS Office
WPS Office is a free, lightweight alternative for viewing PDFs and working with office documents in a familiar interface. Its format compatibility makes it easy to bring existing files into your workflow. Use Acrobat to configure and test the custom PDF calculation described above.

Frequently Asked Questions
What formula does the Rate field use?
The script calculates Rate as Total × 200,000 ÷ Hours. For example, Total of 10 and Hours of 40 produce a Rate of 50,000.
Why is the Rate field blank when Hours is zero?
The custom calculation script checks Hours before dividing. If Hours is zero or empty, it sets Rate to a blank value to avoid division by zero.
What if my fields have different names?
In Prepare a form, open each field's Properties to check its name. Replace "Total" and "Hours" in the script with those exact names.
Why doesn't Rate update after another calculated field changes?
In Prepare a form, open More > Set field calculation order and make sure any calculated Total or Hours fields appear before Rate.
Can every PDF viewer run the calculation script?
PDF viewers differ in their support for form JavaScript. Test the saved form in the viewer your recipients will use; Acrobat or Acrobat Reader with JavaScript enabled is a suitable place to start.




