Skip to main content
Conga Support

How to Compare Two Values in Word Templates using IF Statements

IF fields (also called “IF statements”) allow you to compare two values and display document content based on the result of the comparison.  When used in a Word® template, IF fields are especially useful for comparing the values of Composer® merge fields to display an appropriate result.

 This is Microsoft Office functionality.  Refer to Microsoft Office documentation for additional information about "IF" statements.


Expression1 and Expression2 represent values that you want to compare.  For IF fields used with Composer, the expressions are usually merge fields, text strings or numbers. Expression1 and Expression2 should be surrounded with quotation marks (").

Operator is a comparison operator.  Available operators are:

  = Equal to
  < > Not equal to
  > Greater than
  < Less than
  >= Greater than or equal to
  <= Less than or equal to

TrueText is the value returned when the comparison is true.

FalseText is the value returned when the comparison is false.

Expressions and True/False values must be surrounded with quotation marks.


Always add a space before and after the operator.

We recommend using Word-based merge fields (instead of text-based merge fields) for more consistent behavior.

If the content in Salesforce of your TrueText or FalseText contains quotation marks ( “ or ” ), replace those quotes with a pair of single quotation marks (' ' instead of " ").  Otherwise, Word will consider the first quotation mark from your merged data as the end of your text string and the IF statement will not work.



If an Opportunity's Amount is greater than $10,000, include information about a complimentary service package. If not, show nothing.



In this example, if an Opportunity's Amount is great than $10,000, show information about a complimentary service package. If not, show nothing.

  Step Result
1 Create a traditional merge field with a placeholder name.  «IF_Amount»
2 Toggle open the field codes. { MERGEFIELD IF_Amount \* MERGEFORMAT}
3 Replace the contents of the field with IF followed by a space. { IF }
4 Add Expression1 to the IF field. In this example, Expression1 is the Opportunity Amount field inserted as a traditional merge field. Include a space after the Expression1 value. { IF "«OPPORTUNITY_AMOUNT»" }
5 Insert an operator, followed by a space. This example uses greater than (>). { IF "«OPPORTUNITY_AMOUNT»" > }
6 Insert Expression2, followed by a space. This example is $10,000. { IF "«OPPORTUNITY_AMOUNT»" > "10000" }
7 Insert the TrueText—the value to return if the expression is true—followed by a space. This example's TrueText is the value of a merge field containing the details of a complimentary service package. { IF "«OPPORTUNITY_AMOUNT»" > "10000" "«OPPORTUNITY_SERVICE_PACKAGE»" }

Insert the FalseText value.  In this example, we display nothing if the Opportunity Amount is less than $10,000.

You can display nothing (or a null value) with a pair of double quotation marks that does not contain any text.


The finished IF field: