You are here:

Microsoft Word/Mail Merge - using fields to extract blocks of text from a seperate document based on the mail merge field value



So I'm struggling with something I think is possible but I can't find an easy-to-understand explanation....

My company sells software that can extract its database data into MS Word templates using Mail Merge, all standard stuff. Most common usage is for employment contracts, downloading the details of the contract using Mail merge onto letter-head paper etc.

Some of my customers would like to take a value of a database field like "location" and if the value equals "USA" they would like a different chunk of text in a paragraph than if the field value says "France".

I have learnt that with Mail Merge Field Formatting or Field Switches like "If...then...else" I can present an either / OR situation easily.....but what about more sophisticated variations, perhaps upto 50 different paragraph options for a location field?

For the more sophisticated options I thought it would be easier to store the different text options in a seperate doc, like Word or Excel, then have a reference field switch to the right chunk of text and simply import the relevant option.

I think I can do something with "Bookmarks" on the relevant text file where the options are stored....but now it gets hazy and I reach for coffee! :-)

If you were able to give me a general steer on how to create a field switch which would reference a specific piece of text in a seperate document this would be a great start....

Welcome any help....
Thanks in advance

Example of conditional entries for merge field in mail merge letter.
Example of conditional  
ANSWER: Hi there Tim

I'm not sure if I understand your question, however I imagine in the same situation I would be constructing an IF statement for all the conditions that you want to cover, based on the value that exists in the source field.

Attached is an image of an example letter for which the database contains a field called "COUNTRY". Depending on what value is entered in "COUNTRY", different text appears in the merged letter.

The block of formulae in the attached image will result in a letter where:
If the COUNTRY field contains the value "USA", then the text that will appear in the letter is "Your parcel will arrive in the USA next week sometime", OR if the value in COUNTRY is "Sweden", then the text that will appear in the letter is "Your parcel will never arrive as we do not post to Sweden".... and so on.

I just used the "Insert Word Field" button, then chose the "IF" option to enter each IF statement separately, one after the other. This way, all your conditions for that field are located one after the other, in one block in the document.

I hope this somehow helps you along...

kind regards

---------- FOLLOW-UP ----------

QUESTION: Thanks Karen - this looks a much simpler way of processing the variables and your example does work for me.

Using this IF statement is there no way to link the "IF" to a place in an external/other document?

I'll give your method a try....also has a benefit that we only need one template that needs updating!

many many thanks!

Hi again Tim

I imagine it is possible; you would just have to include the other data file (the one with the conditional text in it) as one of your data sources... then you could probably work that into the formula structure. I am unable to test this theory where I am now, but you sound like you could give it a whirl. Otherwise, I hope the "block" formula approach within the primary merge document will help you get the job done.


About Microsoft Word
This topic answers questions related to Microsoft Word stand-alone or Microsoft Office Word including Word 2003, Word 2007, Office 2000, and Office XP. You can get Word help on formatting text, tables, tabs, fonts, styles, general Word layouts, bullets, headings, and outlines, using templates, toolbar modifications, and using Track Changes. You may also find tips on linking Word and Excel embedded objects including charts. This site does not provide a general Word tutorial nor the basics of using a word processor. It provides specific answers to using Microsoft Word only. If you do not see your Word question answered in this area then please ask a Word question here

Microsoft Word

All Answers

Answers by Expert:

Ask Experts


Karen Lee Biddle


I'be been using Word and other Windows Office software for a long time now and am happy to help you find a solution to to your problem or query. Sometimes I may not have the answer, but hopefully I can put you in the right direction!


Word: experienced with tables, mail merge, graphics, paragraph styles, sections, tables of contents/index. Excel: some formula experience and happy to help find the right formula for the required output.


©2017 All rights reserved.