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.  Also, see How to Create If Fields in Microsoft Word Templates.

 This is Microsoft Office functionality and Conga support is limited. Refer to Microsoft Office documentation for additional information about "IF" statements. Regarding Checkbox values: Although the Conga View Data Workbook and the Template Builder show the value as TRUE, they do not work in Microsoft Word. Change your value from TRUE to True. For example:  {If "<<Checkbox_MergeField>>" = "True" "Yes" "No"}


Nested IF statements, where the "else value" is another conditional IF statements, work successfully with Conga Composer.  Due to the complicated nature of nested IF statements, Conga does not support nested IF statements in Microsoft Word. The recommended alternatives to nested IF statements in Microsoft Word is to use the native IF and CASE Logical Functions in Salesforce formulas.  


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.

It is recommended you use traditional 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.

If using numbers and greater and less than operator, remove the quotes from expression 1 and expression 2 as the statement doesn't render properly post-merge otherwise. If you use Detail Data, place the tablestart/tableend outside the If statement. 



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 (right click and select Toggle 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:


 Do not use with dynamic culture codes.