If Then Field in Mail Merge

I'm using Word 2013 to create a mail merge from an Excel spreadsheet. When I'm doing the address, I'm using the columns for Name, Address Line 1, Address Line 2 and City,State,Zip. A majority of the customers don't have an second address line so I'm wondering how I can create this? If there is nothing in the Address Line 2 cell, then I just have a blank space in the mail merge. Is there a way to have an If/Then statement or something that says to not display it unless there is something in that field?

Thanks!
itgolferAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Professor JMicrosoft Excel ExpertCommented:
there is a very good video toturial here
from Excelvideotraing site

you can download the attachment from the site as well.   it has the option of address line 2

this will get you started, but if you already have a code and you just want to add addtional address line, then please post your code here and we amend it for you.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
GrahamSkanRetiredCommented:
If a line is completely blank, then merge process will omit it altogether. In current Word versions, you would have to use VBA to change that default.
If there is something else on the line (such as Addr2:),  then an IF field would be appropriate.

Show the field codes with the Alt + F9 toggle, and the formatting makes with the Show/Hide button (¶) so that the line
Addr2: <<Address2>>
looks like
Addr2: { MERGEFIELD Address2 }¶
Select the line and hit Ctrl+F9 to surround it with an empty field and type in this text,
{ IF { MERGEFIELD Address2 } = "" "" "Addr2: { MERGEFIELD Address2 }¶
"}
The field can be copied in the usual way and except the field delimiters, the rest of the text can be typed as usual.

You can hide the field codes in the document using the  Alt+ F9 toggle again. However, the merge fields which are now embedded will no longer be visible.
regmigrantCommented:
the default paragraph formatting for merge fields adds trailing space as well as line spacing, if you select all the fields and remove the trailing space in Paragraph formatting you might find you can achieve the result you want
itgolferAuthor Commented:
Thanks for the feeback. After looking, I only had around 26 that had a second line address so I just added the second line for those, printed them and then removed it. Then I printed the rest with just the one address line.
regmigrantCommented:
That's good operational practice ! us IT people frequently look for the 'perfect' answer with high automation and failing to recognise a bit of manual kicking around may be the best way - glad you got a resolution
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Word

From novice to tech pro — start learning today.