How to Create a Yes/No Formula Based on Multiple Fields in Acrobat PDF
Question details
The user wants to display 'YES' if any of several specific PDF form fields contain a value below 2, and 'NO' if none of the fields meet that condition.

- Product
- Adobe Acrobat PDF
- Device & OS
- not provided
- Scenario
- Creating dynamic PDF forms with conditional text values that evaluate multiple numerical inputs.
- Observed behavior
- A target form field needs to automatically output a 'YES' or 'NO' result using a custom formula or script that reads other specific fields.
Ensure you have Adobe Acrobat Pro or a PDF editor that supports JavaScript calculations, and note down the exact names of all the form fields you intend to include in your formula.
Use a Custom JavaScript Calculation in Adobe Acrobat
Apply a custom JavaScript formula to your target field to evaluate an array of specific form fields and automatically return 'YES' or 'NO' based on their values.
PDF forms use JavaScript for advanced custom calculations. By grouping your target fields into an array, you can loop through them to check if any contain a value below your threshold.
Open your document in Adobe Acrobat, navigate to the Tools menu, and select 'Prepare Form'.
Right-click the target text field where you want 'YES' or 'NO' to appear, and select 'Properties'.
Navigate to the 'Calculate' tab in the Properties window and select the 'Custom calculation script' option.
Click the 'Edit' button and paste the following script: `var fields = ["Productivity Score", "Documentation Score", "Accuracy Score", "Feedback Score", "Monitors work Score", "Asks for help Score", "Job duties Score"]; var under2 = false; for (var i = 0; i < fields.length; i++) { var f = this.getField(fields[i]); if (f && f.valueAsString !== "" && Number(f.valueAsString) < 2) { under2 = true; break; } } event.value = under2 ? "YES" : "NO";`
Replace the array strings with the exact names of your actual form fields. Click 'OK' to save the script, then close the Properties window to test the form.

Edit and Manage PDF Forms Seamlessly with WPS Office
WPS Office provides a comprehensive PDF editor that allows you to effortlessly fill, edit, and manage interactive PDF forms, ensuring all built-in scripts and calculations function smoothly.
- 1. Launch WPS PDF: Open WPS Office and navigate to the 'PDF' tab to access the PDF editor.
- 2. Open your form: Click 'Open' and select the interactive PDF form that contains your custom calculations.
- 3. Fill the form: Input your data into the respective fields; the built-in formulas will execute automatically.
- 4. Save your document: Once completed, click the 'Save' icon or export the filled PDF to secure your data.

Frequently Asked Questions
Why is my PDF calculation script not updating automatically when I enter numbers?
You may need to check the field calculation order in your PDF editor. If a field calculates before the data fields it relies on have updated, it will show outdated results. You should also verify that 'Automatically calculate field values' is enabled in your software's preferences.
Can I change the threshold value in the provided formula?
Yes. To change the threshold, locate the `Number(f.valueAsString) < 2` section of the script and replace the number '2' with your required value.
Do custom PDF calculation scripts work in all PDF readers?
Most standard desktop PDF applications, such as Adobe Acrobat and WPS Office, fully support JavaScript calculations. However, some basic browser-based PDF viewers or mobile readers might not execute these scripts correctly.




