Use field references, literals, operators, and functions to build formulas for calculated fields in Adobe Acrobat Sign.
Enter formulas in the Formula property of a field configured with Value type > Calculated. This reference describes the expression syntax available for building those formulas.
To configure the field itself, see Create a calculated field.
Build a formula
A formula can contain one or more of these elements:
| Element | Use it for | Example |
|---|---|---|
| Field reference | Use a value from another field | price * quantity |
| Literal | Include a fixed number, text value, or date | total * 0.10 |
| Operator | Perform arithmetic, comparison, or text operations | subtotal + tax |
| Function | Perform a predefined calculation or logical operation | max(value1, value2) |
Formulas can also reference other calculated fields.
Reference fields by name
Use the field name to reference its value in a formula.
For example:
price * quantity
uses the values of fields named price and quantity.
If a field name contains spaces, enclose the full name in square brackets:
[Unit price] * quantity
Use meaningful, unique field names so formulas remain understandable as a form changes.
See Form field properties for field-name requirements.
Use literal values
A literal is a fixed value included directly in the formula.
Examples include:
- Numbers: 10
- Text: "Approved"
- Dates used by supported date functions
Enclose text strings in single or double quotation marks.
For example:
"Approved"
Literal values can be combined with fields, operators, and functions.
Supported operators
Use operators to perform calculations, combine text, or compare values.
| Operator | Operation |
|---|---|
| + | Add |
| - | Subtract |
| / | Divide |
| * | Multiply |
| & | Combine text strings |
| = | Equal to |
| != | Not equal to |
| < | Less than |
| <= | Less than or equal to |
| > | Greater than |
| >= | Greater than or equal to |
| % | Return the remainder after division |
| ^ | Raise a value to a power |
Comparison operators return a true or false result and can be used inside logical functions.
For example:
total >= 1000
evaluates whether the value of total is at least 1000.
Math functions
| Function | Result |
|---|---|
| abs(number1) | Returns the absolute value of a number. |
| roundUp(number1) | Rounds a number up. |
| roundDown(number1) | Rounds a number down. |
| round(number1) | Rounds a number to the nearest integer. |
| min(number1, number2) | Returns the smaller of two numbers. |
| max(number1, number2) | Returns the larger of two numbers. |
Example
max(Amount1, Amount2)
returns whichever of the two field values is greater.
Date functions
| Function | Result |
|---|---|
| datePart(part, date) | Returns a specified portion of a date as an integer. |
| dateAdd(part, date, addition) | Adds a specified number of date parts to a date. Use a negative value to subtract. |
| dateDiff(part, date1, date2) | Returns the difference between two dates using the specified date part. |
| daysIn(part, date) | Returns the number of days in the specified portion of a date. |
| date(string) | Converts a text value representing a date into a date value that can be used by other functions. |
| now() | Returns the date and time when the formula is evaluated. |
Date-part values
Use these values for the part argument in supported date functions:
| Value | Date or time part |
|---|---|
| y | Year |
| q | Quarter |
| m | Month |
| d | Day |
| h | Hour |
| n | Minute |
| s | Second |
Example
dateAdd("d", StartDate, 30)
adds 30 days to the value of the StartDate field.
Use a negative number to calculate an earlier date:
dateAdd("d", StartDate, -7)
Logic functions
Use logic functions when a calculated value depends on one or more conditions.
| Function | Result |
|---|---|
| if(logical_test, value_if_true, value_if_false) | Returns one value when the test is true and another when it is false. |
| and(logical1, logical2, ...) | Returns true only when all specified conditions are true. |
| or(logical1, logical2, ...) | Returns true when at least one specified condition is true. |
| not(logical) | Reverses a true or false result. |
| lookup(sourceField, values, default_value) | Returns a value associated with the source field or a default when no match is found. |
Use if to choose between results
For example:
if(Total >= 1000, "Approval required", "Approved")
returns one text value when Total is at least 1000 and another when it isn't.
The true and false results can themselves contain expressions.
Combine logical tests (and, or, not)
Use and when every condition must be true:
and(Age >= 18, Consent = "Yes")
Use or when any condition can be true:
or(State = "CA", State = "OR")
Use not when you need the opposite of a condition:
not(Status = "Closed")
Map one value to another with lookup
Use lookup when a source value should return a corresponding value.
For example:
lookup(State, "CA=California,UT=Utah,WA=Washington", "Other")
returns the mapped state name when a match exists and Other when it doesn't.
This is useful when the source value comes from a defined set of choices, such as a Dropdown or Radio button field.
Formula examples
Calculate an amount
quantity * [Unit price]
Multiplies a quantity by a unit price.
Add several values
subtotal + tax + shipping
Adds values from three fields.
Calculate a percentage
subtotal * taxRate
Multiplies one field by a rate stored in another field.
Return a value conditionally
if(quantity >= 10, [Unit price] * 0.9, [Unit price])
returns a discounted value when the quantity reaches the defined threshold.
Calculate a future date
dateAdd("m", StartDate, 12)
returns a date 12 months after StartDate.
Combine text
RecipientName & " - " & Company
combines field values and literal text into one result.
Build formulas that are easier to maintain
Use descriptive field names and keep related calculations as simple as the form allows.
When reviewing a formula, confirm that:
- Every referenced field exists.
- Field names match the names used in the formula.
- Fields containing spaces are enclosed in square brackets.
- Text literals are enclosed in quotation marks.
- Functions contain the required arguments.
- The calculated field produces the intended value for the expected recipient inputs.
For configuring the calculated field and formatting Number results, see Create a calculated field.
تيسير عملك باستخدام Acrobat Sign
قم بإدارة المستندات وتوقيعها عبر الإنترنت بسرعة وسهولة.