Suppress Blank Lines in a mail merge

Anonymous
2010-09-17T14:37:31+00:00

Using Word 2007, I am creating a mail merge. Some addresses have one line, some have two (Suite number, etc.) I want to suppress the second address field only if it is blank, so there are no blank lines in the document after I perform the merge. In older versions of Word, I remember a check box for "suppress blank fields" but I can't seem to find that in 2007.

Microsoft 365 and Office | Word | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments
Answer accepted by question author
Suzanne S Barnhill 279.4K Reputation points MVP Volunteer Moderator
2010-09-17T14:59:46+00:00

In general, blank lines are automatically suppressed, but only if they end in a paragraph break, not a line break. Consequently, the default is not a solution for me and perhaps not for you, either. So you have to use an IF field. Assuming your two address lines are the merge fields Address1 and Address2, you'd have something like this.

{ MERGEFIELD Address1 }<line break>

{ IF { MERGEFIELD Address2 } = "" "" "{MERGEFIELD ADDRESS2}<line break>" }

The way that will actually appear in your document is:

{ MERGEFIELD Address1 }

{ IF { MERGEFIELD Address2 } = "" "" "{MERGEFIELD ADDRESS2}

" }

By putting the line break inside the FalseText quotes, you ensure that thereis a line break only if the line contains text; otherwise, there will be no line.

Was this answer helpful?

10+ people found this answer helpful.
0 comments No comments

49 additional answers

Sort by: Newest
  1. Paul Edstein 82,871 Reputation points Volunteer Moderator
    2014-03-06T20:39:18+00:00

    That's the approach in the post marked as the Answer back on page 1 of this thread. The approach I've suggested is a simpler way of achieving the same outcome.

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2014-03-06T13:45:20+00:00

    Bizarrely I got this to work by accident. I put values in the blank address_2 fields (just to see what happened) then I deleted the values and lo and behold the zero result fields were disappeared. Remarkable how Microsoft works ;). Heres a screenshot of how I did it.

    Happy days.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  3. Paul Edstein 82,871 Reputation points Volunteer Moderator
    2014-03-05T21:23:02+00:00
    1. is there a typo in the last part where you have address line 2 on the second line and on the third line?

    and

    1. how do you get rid of teh chevrons as when I insert teh brackets they do not go away as in your example

    The field code representation is correct.

    The field brace pairs (ie '{ }') for the field code examples discussed in this thread are created in the document itself, via Ctrl-F9 (Cmd-F9 on a Mac); you can't simply type them or copy & paste them from one of the posts. Nor is it practicable to add them via any of the standard Word dialogues. Likewise, you can't type or copy & paste the chevrons (ie '« »') - they're part of the actual mergefields, which you can insert from the mailmerge toolbar. And, instead of the ↵ and ¶ symbols, where shown, you should use real line/paragraph breaks.

    Was this answer helpful?

    0 comments No comments
  4. Anonymous
    2014-03-05T16:57:58+00:00

    That might be OK for Publisher, but this forum is for Word.

    In Word, the simplest way is to add the /b or /f switch, plus the conditional paragraph/line breaks, to the mergefields (don't bother with the AddressBlock). For example, suppose you have:

    «Company»¶

    «Address_Line_1»¶

    «Address_Line_2»¶

    «Address_Line_3»¶

    «City» «State» «ZIP»-«Zip_Plus4»¶

    but «Address_Line_2» and «Address_Line_3» are sometimes empty.

    In this case, you could first delete the paragraph breaks between «Address_Line_1», «Address_Line_2» and «Address_Line_3», so you get:

    «Company»¶

    «Address_Line_1»«Address_Line_2»«Address_Line_3»¶

    «City» «State» «ZIP»-«Zip_Plus4»¶

    Next, you'd select «Address_Line_2» and «Address_Line_3» and press Shift-F9, so you get:

    «Company»¶

    «Address_Line_1»{MERGEFIELD Address_Line_2}{MERGEFIELD Address_Line_3 }¶

    «City» «State» «ZIP»-«Zip_Plus4»¶

    Then you'd add the switches, thus:

    «Company»¶

    «Address_Line_1»{MERGEFIELD Address_Line_2 \b "¶

    "}{MERGEFIELD Address_Line_2 \b "¶

    "}¶

    «City» «State» «ZIP»-«Zip_Plus4»¶

    Do Ctrl-A, F9 to update the fields and your mailmerge is ready to run.

    Note: The ¶ symbols above represent the paragraph marks you'd see when you have Word's formatting display toggled 'on'.

    Hi I've nearly got it but...

    1. is there a typo in the last part where you have address line 2 on the second line and on the third line?

    and

    1. how do you get rid of teh chevrons as when I insert teh brackets they do not go away as in your example

    Many tahnks

    MJ

    Was this answer helpful?

    0 comments No comments