Add calculated fields and conditional logic to a form
Add a Formula field and type an expression such as qty * price or sum(items_*_amount) under Calculation. To hide a field until it's relevant, open its Visibility section, turn on Show only when… and add rules.
Updated 2 min read
Calculated fields
Step 1: Name the inputs
Formulas refer to fields by their Database name (in Field options). Short names like
qty,priceandtax_rateare easier to type.Step 2: Add a Formula field
In Create form mode, choose Formula from Add fields and place it where the result should appear. Formula fields are read-only.
Step 3: Write the formula
Under Calculation, type the expression. Suggestions offer field names and functions as you type, and the panel says Formula is valid. when it can be calculated.
Step 4: Test it
Choose Preview and fill the inputs. The result updates as you type.
| You can use | Example |
|---|---|
+ - * / % ^ and brackets | (hours * rate) - discount |
sum, avg, min, max, count | sum(line1_total, line2_total) |
| Wildcards in those functions | sum(items_*_amount) adds every field named items_…_amount |
round, abs, floor, ceil | round(subtotal * 0.0825, 2) |
if(condition, then, else) with == != < <= > >= && || | if(total > 1000, total * 0.1, 0) |
concat to join text | concat(first_name, " ", last_name) |
Empty fields are skipped by sum, avg, min, max and count. Amount fields round to their currency (two decimals, or whole yen), and you can set Decimals yourself.
Conditional logic: show a field only when…
Step 1: Select the field to hide
Click the field that should appear only sometimes, for example "Spouse's name".
Step 2: Turn on Show only when…
In Field options, open Visibility and turn on Show only when….
Step 3: Add rules
Choose a Field, a Condition and a Value, for example Marital status is Married. Choose Add rule for more, and set Match to all or any of the rules.
Conditions available: is, is not, contains, is greater than, is less than, is empty, is filled, is checked and is not checked. Text comparisons ignore upper and lower case.
- Hidden fields never block submission, even if they're marked Required.
- Formulas and visibility rules run in the PDFBetter editor, on published forms and on signing pages.
- Other PDF readers (Acrobat, Preview) show every field and the last calculated value; they don't run PDFBetter's rules. Publish the form if the logic matters.
Can a formula use a dropdown or checkbox?
Yes. A dropdown's value is the chosen option, and you can compare it in if, for example if(plan == "Pro", 15, 0).
Why does my total show 0?
The input fields are empty, or the formula refers to names that don't match. Check the Database names in Field options.
Tools in this article
Did this answer your question?
Related articles
- Form field types, required fields and validationPick a field type that matches the answer (Email, Date, Number, Phone…) and its format is checked as people type. Tick Required in Field options to stop the form being submitted or signed while the field is empty.
- Make a PDF fillable by adding form fieldsOpen the PDF, switch the top bar to Create form, pick a field type from Add fields and click or drag it onto the page. Set its options on the right, check it with Preview, then download with Keep fillable or publish it as a form.
- Publish a form as a fill link and collect responsesBuild the fields, then choose Done → Publish as form, set the title and options, and select Publish form. You get a link, a QR code and embed code. Respondents don't need an account, and every submission is stored as data and as its own filled PDF.
- Detect form fields automatically with AIIn Create form mode, choose Detect fields, pick the pages and run it. PDFBetter proposes a field for each blank, box and signature line; you tick the ones to keep and choose Add. Each run costs 3 AI credits.