Use a Word IF Field to Replace an Optional Section with Text
Question details
Use a linked Excel value to control whether a Word template displays an optional section or replacement text.

- Product
- Microsoft Word and Microsoft Excel
- Device & OS
- not provided
- Scenario
- A Word template contains an optional section whose content depends on a value linked from Excel.
- Observed behavior
- When the linked value is zero, the template should display “Section Not Required”; otherwise, it should display the section content while retaining the linked field.
Confirm that the Excel source is available and that its linked value updates correctly in Word. The keyboard shortcuts below apply to Word for Windows.
Wrap the linked Excel field in a Word IF field
Use an IF field to display replacement text when the linked value is zero and section text otherwise.
The IF field changes what is displayed; it does not permanently delete the content stored in its field code. For a long or heavily formatted section, test the result carefully before using it throughout a template.
In Word, press Alt+F9 to display field codes. Locate the field that links to the Excel value and select its entire code, including its field braces.
Cut the selected link field, place the cursor where the optional section should appear, and press Ctrl+F9 to insert a new pair of field braces. Type IF followed by a space inside the braces, then paste the link field after it.
After the nested link field, type: = 0 "Section Not Required" "Section 1.1...Section 1.3 content". Replace the second quoted text with the section content you want displayed when the value is not zero. The resulting structure is { IF { LINK ... } = 0 "Section Not Required" "Section content" }; retain your actual LINK field rather than typing the example braces.
Press Alt+F9 to return to field results, select the IF field, and press F9. Change and save the Excel value, update the link in Word, and press F9 again to test both zero and nonzero values.

Work with Word and Excel files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with documents and spreadsheets. It supports common Microsoft Office formats, making it easy to move everyday files between suites. Test complex Word IF fields and external links before relying on them in WPS.

Frequently Asked Questions
Does the IF field delete the optional section?
No. The field displays one result or the other, but the text in its field code remains available. Press Alt+F9 in Word for Windows to inspect the code.
Why does the result not change after I edit Excel?
Save the Excel workbook, return to Word, update the linked field, and then select the IF field and press F9. Check that the source file is available and that Word is allowed to update the link.
Can I type the braces around the IF field?
No. In Word for Windows, press Ctrl+F9 to insert field braces. Typed braces are ordinary text and will not create a field.
Can one IF field cover a section with several subsections?
Yes, the nonzero result can contain text for the section and its subsections. For long or heavily formatted content, test the field carefully because complex formatting may not behave as expected.




