How to use IF Statements for fields in Word document Templates
Table of Contents
To add conditional logic inside Microsoft Word documents, Word supports IF statements using Field Codes, not normal formulas.
What an IF statement in Word is
Word uses this syntax:
{ IF condition "True result" "False result" }
⚠️ Curly braces must be inserted with the keyboard, not typed.
Insert field braces:
👉 Ctrl + F9
Simple example (most common)
Show text only if a value matches
{ IF "{ MERGEFIELD Status }" = "Approved" "Approved ✔" "Pending" }
Used heavily in:
Contracts
Letters
Reports
Mail merge documents
Common use cases
1. Mail Merge conditions
Example: Different greeting based on title
{ IF "{ MERGEFIELD Title }" = "Dr" "Dear Doctor" "Dear { MERGEFIELD FirstName }" }
2. Show / hide clauses
Example: Include a paragraph only if a checkbox is Yes
{ IF "{ REF IncludeClause }" = "Yes"
"This clause applies."
"" }
(Empty quotes = show nothing)
3. Numeric comparison
{ IF { MERGEFIELD Amount } > 10000 "Senior approval required" "" }
Supported operators:
=
>
<
>=
<=
<> (not equal)
4. Nested IF statements
Yes, they work — but keep them readable.
{ IF "{ MERGEFIELD Type }" = "A"
"Type A terms"
{ IF "{ MERGEFIELD Type }" = "B"
"Type B terms"
"Standard terms"
} }
How to work with IF fields properly
Toggle field code view
Alt + F9 → show all field codes
Shift + F9 → toggle selected field
Update fields
Select document → F9
Or right-click field → Update Field
Common mistakes (very common)
❌ Typing {} manually
❌ Forgetting quotes around text
❌ Spaces inside merge field names
❌ Not updating fields after changes
When Word IF statements are the wrong tool
If you need:
- Complex logic
- Calculations
- Repeating data
- Validation rules
Quick checklist
✔ Use Ctrl + F9
✔ Wrap text in quotes
✔ Update fields
✔ Keep logic simple