How to Set Word Mail Merge to Skip Blank Address Lines in Output
🔍 WiseChecker

How to Set Word Mail Merge to Skip Blank Address Lines in Output

When you run a mail merge in Word, blank address lines in your data source can create ugly gaps in the output. For example, a recipient with no apartment number leaves a blank second line, shifting the city and state down. This happens because Word preserves every field even when its source cell is empty. This article explains how to use Word’s field codes and the IF–Then–Else logic to suppress blank address lines so your letters, envelopes, or labels print cleanly without empty rows.

Key Takeaways: Removing Blank Lines From Mail Merge Output

  • Alt+F9 to toggle field codes: Reveals the underlying merge field syntax so you can edit it directly.
  • IF field with MERGEFIELD and MERGESEQ: Tests whether a field is blank and skips it if true, using the “Next Record” trick to avoid duplicate empty lines.
  • Alt+F9 again to return to results: Switches back to the preview so you can verify the output before finishing the merge.

ADVERTISEMENT

Why Word Mail Merge Shows Blank Lines for Empty Fields

Word mail merge pulls data from a source file such as an Excel worksheet, Access table, or Outlook contacts. Each field in the data source maps to a merge field in the Word document. When a source cell is empty, Word still prints the paragraph break or line break associated with that field. The result is a blank line where the field would have appeared.

The default behavior does not include a “skip if empty” option in the mail merge wizard. To remove blank lines, you must edit the underlying field codes. This technique uses the IF field to check whether a merge field contains data. If the field is empty, Word suppresses the line break; if the field has data, Word prints it normally.

You need a data source that has fields for each address component. Common fields include Address_1, Address_2, City, State, and ZIP. The method works with any data source that Word can read.

Steps to Suppress Blank Address Lines Using Field Codes

  1. Open your mail merge main document
    Launch Word and open the document that contains the mail merge fields. This is the document you created using the Mailings tab and the Step-by-Step Mail Merge Wizard.
  2. Press Alt+F9 to show field codes
    Every merge field, such as «Address_1», becomes a field code like { MERGEFIELD Address_1 }. The document now shows the raw code instead of the preview data.
  3. Locate the first address field code
    Find the field code for the topmost address line. For a typical address block, this is often Address_1 or Street. Click immediately after the closing curly brace of that field code.
  4. Insert an IF field around the address line
    Press Ctrl+F9 to insert a new, empty pair of field braces { }. Inside those braces, type the following exactly:
    IF "{ MERGEFIELD Address_1 }" <> "" "{ MERGEFIELD Address_1 }"
    Do not type the outer braces; Word adds them when you press Ctrl+F9. This tells Word: if the Address_1 field is not blank, show the Address_1 field; otherwise, show nothing.
  5. Remove the original MERGEFIELD code
    Delete the original { MERGEFIELD Address_1 } code that you wrapped. Only the IF field code should remain for that line. The line now contains only the IF field.
  6. Handle the paragraph mark for the blank line
    The blank line comes from the paragraph mark after the field. To suppress it, you must include the paragraph mark inside the IF field’s “true” part. Move the paragraph mark (the invisible line break) into the true part of the IF field. The code becomes:
    IF "{ MERGEFIELD Address_1 }" <> "" "{ MERGEFIELD Address_1 }¶"
    The ¶ symbol represents the paragraph mark. To insert it, place the cursor where the paragraph mark should be and press Enter while inside the true part.
  7. Repeat for each address field
    Apply the same IF field structure to Address_2, City, State, and ZIP. For the last field on a line, such as City, State, ZIP, combine them into a single IF field. Example:
    IF "{ MERGEFIELD City }" <> "" "{ MERGEFIELD City }, { MERGEFIELD State } { MERGEFIELD ZIP }"
    This prevents a blank City from leaving a comma and space.
  8. Press Alt+F9 to return to field results
    Word now shows the preview. If a field is blank in the current record, the line disappears entirely. Use the Preview Results button on the Mailings tab to cycle through records and verify.
  9. Complete the merge
    Click Finish & Merge on the Mailings tab and choose Edit Individual Documents, Print Documents, or Send E-mail Messages. The output contains no blank address lines.

ADVERTISEMENT

If the Merge Still Shows Blank Lines

The IF field has a syntax error

A missing quotation mark, extra space, or incorrect curly brace breaks the IF field. Press Alt+F9 to check the code. The correct pattern is:
{ IF "{ MERGEFIELD FieldName }" <> "" "{ MERGEFIELD FieldName }¶" }
Note that the field name inside the nested MERGEFIELD must match exactly the name in your data source. Spaces in field names require quotes around the name.

The paragraph mark is outside the IF field

If the paragraph mark remains after the closing brace of the IF field, Word prints it regardless of the IF test. Move the paragraph mark inside the double quotes of the true part. You can also delete the paragraph mark and press Enter while the cursor is inside the true part.

Multiple consecutive blank fields still produce a line

If Address_1 is blank but Address_2 has data, the IF field for Address_1 suppresses its line, and the IF field for Address_2 shows its line. This works correctly. The problem occurs when you have two fields on the same line, such as City and State, and City is blank. The solution is to combine them into one IF field that checks only the first field. If City is blank, the entire line is suppressed even if State has data.

Mail Merge Field Codes vs the Address Block: Key Differences

Item Individual MERGEFIELD codes Address Block (ADDRBLOCK)
Control over each line Full control per field Limited to built-in settings
Blank line suppression Manual IF field editing required Automatic if “Always include country/region” is unchecked
Field name dependency Must match data source exactly Uses mapping to standard fields
Learning curve Higher; requires field code knowledge Lower; uses wizard dialogs
Best for Custom layouts with optional lines Standard address blocks with predictable fields

The Address Block feature in Word can suppress blank lines automatically when you configure the matching options. However, it only works with fields that Word recognizes. If your data source uses custom field names, the Address Block may not map correctly, and the IF field method is the reliable alternative.

You can now modify any mail merge document to skip blank address lines using IF field codes. Start with a copy of your main document and test with a few records before running the full merge. For advanced control, combine the IF field with the SKIPIF field to skip entire records when a key field is blank. The SKIPIF field goes in the data source document, not the main document, and prevents the record from appearing in the output at all.

ADVERTISEMENT