Calculate Minimum Value Ignoring Blank Fields in Adobe Acrobat
Question details
The user needs to calculate the minimum value from a specific range of PDF form fields (SR-1 through SR-31) without letting empty fields evaluate as zero.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Setting up a calculated field in a PDF form that accurately reflects the lowest submitted numerical value among multiple inputs.
- Observed behavior
- Acrobat's built-in Minimum calculation automatically treats blank fields as zero, causing the calculation to return an incorrect minimum value instead of ignoring the unpopulated fields.
Ensure you have the 'Prepare Form' tool enabled in your PDF editor and take note of the exact field names (e.g., SR-1 to SR-31) you want to include in the calculation.
Use a Custom JavaScript Calculation
By applying a custom JavaScript snippet, you can extract only non-blank values, sort them numerically, and output the correct minimum value.
Acrobat's built-in Minimum function defaults to evaluating blank fields as zero, which disrupts accurate calculations. A custom loop script easily bypasses this by filtering out empty strings before determining the lowest number.
Open your PDF form in 'Prepare Form' mode. Right-click the specific text field where you want the minimum value to be displayed and select 'Properties'.
In the Text Field Properties dialog box, navigate to the 'Calculate' tab. Select the radio button labeled 'Custom calculation script'.
Click the 'Edit' button and paste the following script: function numericSort(a, b) { return Number(a) - Number(b); } var values = []; for (var i = 1; i <= 31; i++) { var f = this.getField("SR-" + i); if (f.valueAsString !== "") values.push(Number(f.value)); } event.value = values.length ? values.sort(numericSort)[0] : "";
Click 'OK' to close the JavaScript editor, then click 'Close' on the Properties window. Enter some test numbers into your fields to verify that the minimum value ignores any blank spaces.

Easily Edit and Manage PDF Forms with WPS PDF
If you are designing complex PDF forms and need a streamlined way to create, edit, and implement calculation scripts, WPS Office provides a powerful, built-in PDF toolset perfectly designed for both beginners and advanced users.
- 1. Download the Software: Download and install WPS Office from the official website to access the comprehensive PDF editor.
- 2. Open Your Form: Launch the application and open your interactive PDF document using the WPS PDF tool.
- 3. Edit Form Fields: Navigate to the 'Form' tab on the top ribbon to easily add, modify, or format text fields and calculation rules.
- 4. Save Safely: Save your updated PDF form, preserving all JavaScript properties and interactive elements across all PDF viewers.

Frequently Asked Questions
Why does the built-in Acrobat Minimum function return zero for blank fields?
Adobe Acrobat's default calculation engine strictly interprets empty field values as zero when using the standard Minimum function. Therefore, any unpopulated field included in your selected range will force the minimum result down to zero.
How do I ignore blanks when calculating the Maximum value?
Acrobat's built-in Maximum calculation natively ignores blank fields. You can safely use the default 'Value is the maximum of the following fields' option in the Calculate tab without needing a custom JavaScript script.
Can I adapt this calculation script for different field names?
Yes. If your fields use a different naming structure, simply update the 'this.getField("SR-" + i)' line in the script to reflect your specific prefix. For example, change it to 'this.getField("Score_" + i)' if your fields are named Score_1, Score_2, etc.
Does this JavaScript work on mobile PDF readers?
Custom JavaScript calculations are fully supported on comprehensive desktop editors like Adobe Acrobat and WPS Office. However, many mobile PDF viewer applications restrict or disable JavaScript execution for security or performance reasons, meaning the calculation may not automatically update on a smartphone.




