Compares two values and then inserts the text appropriate to the result of the comparison. If used in a mail merge main document, the IF field can examine information in the merged data records, such as postal codes or account numbers. For example, you can send letters to only those clients located in a particular city.
- Expression1, Expression2
- Values you want to compare. These expressions can be bookmark names, strings of characters, numbers, nested fields that return a value, or mathematical formulas. If an expression contains spaces, enclose the expression in quotation marks.
- Operator
- Comparison operator. Insert a space before and after the operator.
Operator | Description |
---|---|
= | Equal to |
<> | Not equal to |
> | Greater than |
< | Less than |
>= | Greater than or equal to |
<= | Less than or equal to |
- TrueText, FalseText
- Text that results when the comparison is true (TrueText) or false (FalseText). If FalseText isn't specified and the comparison is false, the IF field has no result. Each string containing multiple words must be enclosed in quotation marks.
Note If the operator is = or <>, Expression2 can contain a question mark (?) to represent any single character or an asterisk (*) to represent any string of characters. Expression2 must be enclosed in quotation marks so that it's compared as a character string. If you use an asterisk in Expression2, the portion of Expression1 that corresponds to the asterisk and any remaining characters in Expression2 cannot exceed 128 characters.
The following example specifies that if the customer order is greater than or equal to 100 units, the result is "Thanks"; but if the customer order is fewer than 100 units, the result is "The minimum order is 100 units".
{IF order>=100 "Thanks" "The minimum order is 100 units"}