Using If Statements in Word
There may be situations where you want to insert conditional language into a document without using a macro. This can be completed by doing the following:
  • Inserting a Field: select where you would like to insert your conditional language, then click on Insert - Quick Parts - Field from the ribbon.
  • Select Field Name: from the resulting Field dialog box, select If from the list of field names.
  • Begin Your Conditional Statement: type the following: IF 1=2 "3" "4", and hit OK. You will then see an error as follows: Error! Unknown op code for conditional.
  • Create Your Statement: right click this error and select Toggle Field Codes from the resulting menu. The following will then appear: { IF 1=2 "3" "4" \*MERGEFORMAT}. You will need to make the changes listed below. Please note that when making these changes, you may need to Toggle Field Codes multiple times because some changes will automatically un-toggle the field.
  • Change Formatting: change\*MERGEFORMAT to\*CHARFORMAT. Otherwise, all formatting will be pulled from the source document.
  • Modify First Expression in Conditional Statement: highlight the "1" and select Mailings - Insert Merge Field. Then select the field which will be evaluated for the conditional language (Ex. VestPct).
  • Modify Second Expression in Conditional Statement: highlight the "2" and change it to the value which when equal to the first expression will return text associated with the TRUE condition.
  • Insert True and False Text: Substitute "3" with the true text (Ex. "You are vested"). Substitute "4" with the false text (Ex. "You are non-vested"). These should both be enclosed in quotes.
  • Check Your Work: Your final product should look something like this:

    { IF {MERGEFIELD VestPct } = "1" "You are vested" "You are non-vested" \*CHARFORMAT }
Prior Next
PensionSoft Corporation | 860.540.3690 | support@pensionsoft.com