How to Remove Blank Lines for Empty Fields in Word Mail Merge
Question details
The user wants to suppress an entire line, including its label and spacing, in a Word mail merge document when the corresponding data field (like an IBAN) is blank in the source file.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Performing a mail merge where some records have empty values for specific fields, requiring conditional formatting to avoid displaying awkward blank spaces or label-only lines.
- Observed behavior
- When the merge field is empty, the document leaves a blank line or leaves the static label (e.g., "IBAN:") hanging without a value, taking up unnecessary space.
Ensure your data source (like Excel) is correctly linked to your Word document and that you know the exact column header name of the field that might be empty.
Use an IF Field to Conditionally Display the Label and Line Break
By using Word's IF field, you can configure the document to only insert the label, the merge field, and the paragraph mark if the field actually contains data.
This method uses a conditional IF statement to check if the merge field is empty. If it is not empty, it prints the label, the data, and a paragraph mark. If it is empty, it prints nothing, effectively removing the blank line.
Press Ctrl + F9 to insert a pair of field braces { }. Do not type these manually, as Word will not recognize them as a field code.
Inside the braces, type IF followed by a space. Press Ctrl + F9 again to insert nested braces, and type MERGEFIELD followed by your field name (e.g., MERGEFIELD IBAN).
After the nested merge field, type <> "" to instruct the field to check if the data is not equal to blank.
Type a space, then open quotation marks. Type your label (e.g., IBAN: ), press Ctrl + F9 to insert another { MERGEFIELD IBAN }, and press Enter to add a paragraph mark (or Shift + Enter for a line break) before closing the quotation marks.
Your complete formula should look like: { IF { MERGEFIELD IBAN } <> "" "IBAN: { MERGEFIELD IBAN }¶" }. Right-click the field and select 'Update Field' or press Alt + F9 to toggle the field codes and view the merged result.

Perform Seamless Mail Merges with WPS Writer
WPS Writer offers robust Mail Merge capabilities that fully support advanced field codes, including IF statements, allowing you to easily suppress blank lines and conditionally format your documents.
- 1. Open Data Source: Open WPS Writer, navigate to the 'Mailings' tab, click 'Mail Merge', and select 'Open Data Source' to link your Excel file.
- 2. Insert Field Codes: Use Ctrl + F9 to insert field braces and type out your conditional IF statement to hide blank lines seamlessly.
- 3. Preview Results: Click 'View Merged Data' on the ribbon to preview how your conditional fields handle empty data before finalizing.
- 4. Merge to Document: Click 'Merge to New Document' to generate your final formatted letters or labels without any unwanted blank lines.

Frequently Asked Questions
Why is my IF field showing the formula text instead of the actual data result?
You likely have field codes toggled on in your document. Press Alt + F9 (or Fn + Alt + F9 on some laptop keyboards) to toggle between displaying the raw field codes and their actual merged results.
Can I use a line break instead of a paragraph mark in the IF field?
Yes. Inside the quotation marks for the true condition, simply press Shift + Enter to create a manual line break instead of pressing Enter for a standard paragraph mark.
Does the conditional IF field method work for fields inside tables?
Yes, it works inside tables. However, table cells can sometimes retain minimum heights or have extra spacing. Ensure absolutely no extra spaces or quotation marks are left outside your field braces within the cell.
How do I handle multiple fields that might be empty on the same line?
You can place individual IF fields sequentially for each data point on that line. Just ensure each IF field contains its own conditional spacing (like a space or comma within the quotation marks) so that no stray punctuation is left behind when a field is blank.




