Share via

Complex Mail Merge

Anonymous
2019-02-07T20:41:51+00:00

I have an excel file with various columns. I am trying to create a letter with a conditional merge.

«name»

«city», «state» «zip_code»

 Thank you for your recent gift [if «tribute» is blank, enter a '.'; else enter a 'space' «tribute type» 'space' «tribute_name» '.']

the results would be:

  1. Thank you for your recent gift. («tribute» was blank)
  2. Thank you for your recent gift in honor of John Smith. («tribute type»=in honor of; «tribute_name»=John Smith)

Excel fields:

name          city           state     zip code     tribute type     tribute name

Jim Dunn    Boston     MA       12345         

Tim Jones   New York NY        10000         in honor of      John Smith

etc

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

Paul Edstein 82,861 Reputation points Volunteer Moderator
2019-02-08T05:30:20+00:00

That's as simple as editing your mergefields, which you can do by selecting them and pressing Shift-F9.

Starting with:

Thank you for your recent gift«tribute_type»«tribute_name».

select both mergefields and press Shift-F9. You should now see:

Thank you for your recent gift{MERGEFIELD tribute_type \b " "}{MERGEFIELD tribute_name \b " "}.

Edit the field code so you end up with:

Thank you for your recent gift{MERGEFIELD tribute_type \b " "}{MERGEFIELD tribute_name \b " "}.

Re-select the fields and press F9 when you're done. You can now run your merge.

Was this answer helpful?

2 people found this answer helpful.
0 comments No comments

Answer accepted by question author

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2019-02-08T04:22:47+00:00

The required field construction would be

Thank your for your recent gift{ IF { MERGEFIELD "tribute_type" } = "" "." " { MERGEFIELD "tribute_type" } { MERGEFIELD "tribute_name" } }

Note that you must use CTRL+F9 to insert each pair of field delimiters and you use ALT+F9 to toggle off their display.

Note also:

  1. There is no space between the t in gift and the first delimiter {
  2. There is a space between the opening quote before the second { MERGEFIELD "tribute_type" }

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Jay Freedman 207.7K Reputation points Volunteer Moderator
    2019-02-08T02:02:29+00:00

    The article at https://wordmvp.com/FAQs/MailMerge/MMergeIfFields.htm is specifically about this sort of IF field logic. Although it dates from about 2003, everything in it still applies to the latest Word versions.

    A far more comprehensive article about mail merge IF fields is at https://wordmvp.com/FAQs/MailMerge/MMergeIfFields.htm.

    The construction you posted is the right format, you just need to translate it into the field syntax that Word accepts.

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments