# Comparison Statements in Formulas and Mandatory Rules

Updated 3 years ago by dustin keir

Rules for mandatory user-defined fields consist of comparison statements. Formula user-defined fields may also include comparison statements if the formulas include conditional expressions, using “If” statements.

You can create comparison statements with the following symbols:

• == to check that two values are equal to each other.
• For example, [Category] == “Partner” verifies that the Category field is set to “Partner”.
• != to check that two values are not equal to each other.
• For example, [Category] != “” verifies that the Category field is not empty, i.e. it has a value.
• > to check that the first value is greater than the second value.
• For example, [Annual Sales] > 20000 verifies that the Annual Sales user-defined field has a value greater than 20,000.
• to check that the first value is less than the second value.
• For example, [Contract Expiry Date] < [Last Service Date] verifies that the Contract Expiry Date field is earlier than the Last Service Date field.
• >= to check that the first value is greater than or equal to the second value.

• <= to check that the first value is less than or equal to the second value.
Comparison statements are often combined with logical operators to add multiple statements together.

You can compare any values including alphanumeric, date, and numeric values. Alphanumeric values are compared by checking the alphabetical order of the string. When you compare values from table fields, they are treated as alphanumeric values.

Comparison statements are case sensitive. If you want to ignore the case of fields, include the Lowercase or Uppercase function in the statement.

For example,

`[City] == "Vancouver" `

is true only if the value of the City field is set to

`"Vancouver". `

However,

`Lowercase([City]) == "vancouver" `

is true if the value of the City field is set to

`"Vancouver", "vancouver", OR "VANCOUVER".`
To compare a table field that contains multiple values, the comparison statement must include the same text that’s displayed in the Maximizer interface, including all values for the field.

For example, the statement

`[Category] == "Partner" `

will be true only if the only value set in the Category field is

`"Partner"`

If the Category field also includes the value

`"Distributor" `

the rule would validate with the following statement:

`Category == "Distributor, Partner" `
You can use the Search function to locate text in multiple-value table fields.