Template Issues

Use a Word IF Field to Replace an Optional Section with Text

Kushani NimanthikaKushani Nimanthika Nov 27, 2026 868 views

Question details

Use a linked Excel value to control whether a Word template displays an optional section or replacement text.

Use a Word IF Field to Replace an Optional Section with 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.
Before you start

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.

Solution 1Recommended

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.

1
Show the existing link field

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.

2
Insert an IF field

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.

3
Add the two outcomes

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.

4
Update and test the field

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.

Wrap the linked Excel field in a Word IF field
Use real field braces: Word field braces must be inserted with Ctrl+F9; braces typed on the keyboard do not create a working field. If Word prompts you to update external links, allow the update only if you trust the Excel source.
Free Microsoft Office alternative

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.

Free, lightweight tools for documents and spreadsheetsCompatible with common Word DOCX and Excel XLSX filesA familiar interface for editing document templatesOpen existing Office files to support a smooth transition
microsoft office alternative - wps office

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.