How to Conditionally Remove an Address Line in Word Mail Merge
Question details
The user wants to omit a specific mail merge address line (Add2) when it contains a certain value (such as London), ensuring that the subsequent line (Add3) shifts up without leaving a blank space.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Creating mail merge labels with multiple address lines where some lines must be conditionally hidden based on their content.
- Observed behavior
- The user needs to dynamically adjust the layout of merge fields to avoid empty lines when a specific condition is met during the merge process.
Ensure your data source is correctly linked to your Word document and that you have basic familiarity with inserting and previewing mail merge fields.
Use Nested IF Fields to Control Paragraph Breaks
Dynamically check the value of the address field and include the paragraph break only when the address line is supposed to be displayed.
By using Word's IF field, you can evaluate whether the 'Add2' field contains 'London'. If it does not, the field and its subsequent paragraph mark are inserted. If it does, both are omitted, allowing 'Add3' to shift up automatically.
Press Ctrl+F9 in your document to insert a pair of blank field braces { }.
Inside the braces, construct your IF condition. For example: { IF { MERGEFIELD Add2 } <> "London" "{ MERGEFIELD Add2 }¶" "" } (Note: Replace the ¶ symbol by actually pressing the Enter key to create a paragraph break inside the quotation marks).
Press Alt+F9 to toggle field codes and view the standard document layout.
Click 'Preview Results' in the Mailings tab to verify that the address line is omitted and the lines below it shift up correctly when the condition is met.
Streamline Your Mail Merge with WPS Writer
WPS Writer offers an intuitive mail merge feature that seamlessly connects with spreadsheets and databases. Easily insert rules, map fields, and format your labels without complex manual coding.
- 1. Open Data Source: Open your document in WPS Writer, go to the 'Mailings' tab, and click 'Open Data Source' to connect your spreadsheet.
- 2. Insert Merge Fields: Use the 'Insert Merge Field' button to add your Add1, Add2, and Add3 fields into the document layout.
- 3. Apply Merge Rules: Click the 'Rules' button on the ribbon to insert IF...THEN...ELSE conditions to handle blank lines and specific criteria effortlessly.
- 4. Preview and Complete: Select 'View Merged Data' to check your labels, then click 'Merge to New Document' to complete the process.

Frequently Asked Questions
Why does my mail merge leave blank lines for empty address fields?
By default, Word may leave an empty line if a field is entirely blank, especially if the paragraph mark is placed outside the field code. Using IF fields ensures absolute control over spacing and conditional logic, preventing unwanted gaps.
How do I edit an existing IF field code?
Press Alt+F9 (or Option+F9 on Mac) to reveal the field codes in your document. You can then click inside the braces to edit the text and logic. Press Alt+F9 again to hide the codes and return to the normal view.
Can I use multiple conditions to hide an address line?
Yes, you can nest multiple IF fields or use a COMPARE field within your primary IF statement to evaluate complex criteria. However, ensure every nested set of braces is created using Ctrl+F9.




