PDF Editing Issues

Calculate PDF Form Fields Using Dropdown Values in Adobe Acrobat Pro

Phi Hung VoPhi Hung Vo Nov 18, 2026 869 views

Question details

Calculate a PDF form field by multiplying a numeric Size field by a rate based on the selected Category dropdown option.

Calculate PDF Form Fields Using Dropdown Values in Adobe Acrobat Pro
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
A form creator wants a calculated field to use different multipliers for different Category selections.
Observed behavior
The calculated field should display Size multiplied by the rate assigned to the selected Category.
Before you start

Open the PDF in Adobe Acrobat Pro and confirm that it has a numeric Size field, a Category dropdown, and a separate field for the result. Check the exact field names and dropdown export values in Prepare a form.

Solution 1Recommended

Add a Custom Calculation Script to the Result Field

Use this method to calculate the result automatically in an Acrobat PDF form.

In JavaScript, = assigns a value, while === compares values. The category strings in the script must match the dropdown's export values, or its displayed items if no separate export values are set.

1
Open the form editor

Open the PDF in Acrobat Pro, then choose All tools > Prepare a form.

2
Open the result field properties

Double-click the field that should display the result, then select the Calculate tab.

3
Enter the calculation script

Select Custom calculation script and click Edit. Enter: var category = this.getField("Category").value; var size = Number(this.getField("Size").value); if (category === "Small" || category === "Medium") event.value = size * 17; else if (category === "Large" || category === "Low/Zero") event.value = size * 25; else if (category === "Low") event.value = size * 100; else event.value = "";

4
Test the form

Click OK, close the field properties, and use Preview in Prepare a form. Enter a Size and select each Category option to check the result, then save the PDF.

Add a Custom Calculation Script to the Result Field
Check field names and values: Replace Category and Size in the script if your fields have different names. An empty Size field converts to zero in this example; add validation if a blank result is required instead.
Free Microsoft Office alternative

Edit Related Documents and Spreadsheets with WPS Office

WPS Office is a free, lightweight alternative for working with documents and spreadsheets in a familiar interface. Its Microsoft Office format compatibility helps you migrate existing files, although it does not fix Acrobat's JavaScript calculation script.

Work with numeric data and formulas in WPS SpreadsheetOpen and edit Microsoft Office formats, including DOCX and XLSXUse a familiar interface for everyday document tasksKeep a lightweight office suite alongside your PDF workflow
QA img-9

Frequently Asked Questions

Why does my JavaScript condition use the wrong category?

Check that the condition uses === for comparison rather than =, which assigns a value. Also verify the dropdown's export values in its field properties.

Where do I add the calculation script in Acrobat Pro?

Choose All tools > Prepare a form, double-click the result field, and open Calculate > Custom calculation script > Edit.

What rates does the example script use?

Small and Medium use 17, Large and Low/Zero use 25, and Low uses 100. Edit the numbers in the custom calculation script to change the rates.

Why does an empty Size field produce zero?

Number converts an empty value to zero. If you want the result to stay blank, check whether Size is empty before converting it and set event.value to an empty string.