Document Editing Problems

How to Use Word Field Codes for Dynamic Paragraph Numbering

Olivia MillerOlivia Miller Oct 22, 2026 869 views

Question details

The user needs to set up dynamic paragraph numbering using conditional IF field codes without generating empty numbered lines when the condition is false.

How to Use Word Field Codes for Dynamic Paragraph Numbering
Product
Word
Device & OS
not provided
Scenario
Creating a document where specific numbered paragraphs are conditionally included or excluded based on IF field results.
Observed behavior
When the IF condition is false, the text is omitted but a blank numbered paragraph remains, disrupting the consecutive numbering sequence of the document.
Before you start

Ensure your document is set to display formatting marks (Ctrl+Shift+8) and reveal field codes (Alt+F9) so you can accurately place the paragraph mark inside your field logic.

Solution 1Recommended

Enclose the Complete Paragraph and Mark within the IF Field

By placing the entire paragraph, including its final paragraph mark, inside the true condition of the IF field, the line and its numbering are completely omitted if the condition is false.

A common mistake when setting up conditional numbering is leaving the paragraph mark outside the field code. Because list numbering is tied to the paragraph mark, leaving it outside the IF statement forces the number to appear even if the text is hidden.

1
Insert the IF field code

Press Ctrl+F9 to insert a pair of blank field brackets {}. Inside the brackets, type IF followed by your logical condition (e.g., { IF { REF Age } < 5 }).

2
Add the true text condition

Type quotation marks for the true result. Enter your text inside these quotes. Crucially, press the Enter key before typing the closing quotation mark so that the paragraph mark (¶) is enclosed within the quotes.

3
Define the false condition

Type a pair of empty quotation marks "" at the end of the field code to tell the software to output nothing if the condition is not met.

4
Apply paragraph numbering

Select the text inside the true condition quotes and apply your desired numbered paragraph style from the Home tab.

5
Update the fields

Press Alt+F9 to hide the field codes, select the entire document by pressing Ctrl+A, and press F9 to update all fields and apply the dynamic numbering correctly.

Enclose the Complete Paragraph and Mark within the IF Field
Formatting Success: When correctly formatted, false conditions will entirely omit the paragraph, and the following paragraph will automatically adopt the next correct consecutive number.

Manage Dynamic Numbering with WPS Writer

WPS Writer natively supports advanced field codes, including IF statements and dynamic paragraph numbering, allowing you to build complex conditional documents effortlessly with high compatibility.

  1. 1. Open Document: Launch WPS Writer and open your target document.
  2. 2. Insert Field: Go to the Insert tab, click 'Quick Parts', select 'Fields', or simply press Ctrl+F9 to create the field brackets.
  3. 3. Input Condition: Type your IF statement, making sure to hit the Enter key to include the paragraph mark inside the true condition's quotation marks.
  4. 4. Update and Test: Select the text and press F9 to update the field code and verify your sequential dynamic numbering.
Fully compatible with Microsoft Word field codes and formatting rulesAdvanced Multilevel List customization for precise document structuringLightweight application with an intuitive interfaceFree tools for managing document styles and conditional logic
microsoft office alternative - wps office

Frequently Asked Questions

Why does an empty numbered list item appear when the IF condition is false?

This happens because the paragraph mark, which contains the numbering formatting, is located outside the field code. To fix it, ensure the paragraph mark is placed inside the quotation marks of the 'True' result in your IF field.

How do I view the hidden paragraph marks and field codes?

To view paragraph marks, click the 'Show/Hide' paragraph marks icon (¶) on the Home tab or press Ctrl+Shift+8. To toggle between viewing field codes and their results, press Alt+F9.

Can I use ListNum fields instead of IF fields for paragraph numbering?

While the ListNum field is great for inserting a number within a line of text, it is less reliable for conditional paragraph formatting. Using a linked numbered paragraph style inside the 'True' text of an IF field is better when you need to conditionally omit entire paragraphs.