How to Remove the Negative Sign from Acrobat PDF Form Calculations
Question details
The user needs to display a calculated cost value in a PDF form as a positive number, removing the minus sign when the formula inherently returns a negative result.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Calculating profit and cost across multiple text fields in an interactive PDF form.
- Observed behavior
- The form field correctly calculates the cost but displays it as a negative value, whereas the user prefers the absolute positive number format without the minus sign.
Ensure you are using a PDF editor that supports custom JavaScript for form field calculations, and take note of the exact names of the text fields you plan to calculate.
Use Custom JavaScript with Math.abs()
Override the default PDF calculation settings by using a custom JavaScript function to format the output as an absolute value.
When standard calculation features in Adobe Acrobat display a negative number, you can bypass this by writing a custom calculation script. By utilizing the JavaScript `Math.abs()` function, the form will automatically convert any negative calculation result into a positive number by removing the minus sign.
Open your document in Adobe Acrobat, navigate to the 'Tools' menu, and select 'Prepare Form' to enable field editing.
Right-click on the specific text field where you want the final calculated value to appear and click on 'Properties'.
In the Properties dialog box, go to the 'Calculate' tab, choose the 'Custom calculation script' option, and click the 'Edit' button.
Define your field variables and apply the Math.abs() method. For example: `var v1 = +getField("Field1").value; var v2 = +getField("Field2").value; var result = v1 - v2; event.value = result < 0 ? Math.abs(result) : "";`
Click 'OK' to save your custom script, close the Properties window, and test your form by entering values to verify the negative sign has been removed.

Manage and Edit PDF Forms with WPS Office
WPS Office offers a comprehensive, highly compatible PDF editor that allows you to easily create, edit, and manage interactive PDF forms without needing expensive software.
- 1. Download WPS Office: Install WPS Office for free from the official website and launch the application.
- 2. Open Your PDF Document: Click 'Open' and select your PDF form file to load it into the WPS PDF editor.
- 3. Navigate to the Form Tools: Select the 'Form' tab on the top ribbon to access the interactive form creation and editing tools.
- 4. Edit Form Fields: Click on any text field to adjust its properties, appearance, and calculation settings to suit your document requirements.

Frequently Asked Questions
Why does my PDF form field display a negative sign?
By default, if the mathematical operation in your PDF form subtracts a larger number from a smaller one, the result is mathematically less than zero. Acrobat displays this exactly as calculated unless you intervene with custom formatting or JavaScript.
What does Math.abs() do in a custom PDF script?
The `Math.abs()` function in JavaScript returns the absolute value of a given number. This means it evaluates the magnitude of the number regardless of its sign, effectively stripping the minus sign from negative results.
Can I hide the field completely if the result is positive?
Yes. Using a conditional ternary operator in your script, such as `event.value = result < 0 ? Math.abs(result) : "";`, tells the form to display the absolute value if the result is negative, but outputs an empty string (hiding the value) if the result is zero or positive.




