Share via

Problem Creating A Directory With Merge Fields

LemP 74,945 Reputation points Volunteer Moderator
2020-05-16T00:42:43+00:00

A couple of years ago, I created a directory using Word's Mail Merge.  The document has a fairly complicated set of Merge Fields and Rules (so if a field is empty, the text isn't printed).

I'm trying to create an updated directory, but I'm doing something wrong.

I have a Word 2016 document with the Merge Fields.

I go to "Mailings," select "Start Mail Merge," and select "Directory."

I use "Select Recipients" to select an Excel 2016 file that has all the data.

If I use "Preview Results" and step through the entries in the Excel file, each entry displays correctly.

I then select "Finish and Merge," select "Edit individual documents," select All merge records, and click OK, the newly-created document only has one entry -- the data from the last row in the Excel file.

What am I not doing right in order to have the directory filled with all the data from the Excel file?

I don't think it's a problem with the merge fields, because I copied them from the original file that I used 2 years ago and also the "preview" works just as it's supposed to.  However, just in case, here's what it looks like:

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

Doug Robbins - MVP - Office Apps and Services 323.1K Reputation points MVP Volunteer Moderator
2020-05-17T02:22:08+00:00

You can achieve what you are after by using the Many to One facility on my Merge Tools Add-in that is contained in the MERGE TOOLS ADD-IN.zip file that you can download from the following page of my One Drive:

http://bit.ly/1hduSCB

Extract the files from the archive and read the:

“READ ME – Setting up and using the Merge Tools Add-in.pdf

to see how to install and use the various tools.  Using those tools, it is possible to perform the following types of merge that cannot be done with Mail Merge “out-of-the-box”:

●    Merge to e-mail messages either with or without attachments, with the documents created by the merge being sent as either Word or PDF attachments or as the body of the e-mail message.

●    Merge to individual documents in either Word or PDF format with the filenames being supplied by the data in one of the fields in the data source

●    Many to One type merges, which can be used for creating documents such as invoices where there are multiple records in the data source that have common data in one of the fields

●    Merging to a document that will include a chart that is unique to each record in the data source

●    Merging a document with Content Controls

●    Merging a document that contains Legacy FormFields

●    Duplex Merges

●    Merging to a printer that will collate and staple the output created from each record in the data source.

The requirements for using the system are:

●    The mail merge main document must be of the Letters type, though that does not mean that the output cannot be sent as an e-mail message where relevant.

●    For the Many To One, Merge with Attachments and Merge to Individual Docs utilities, the data source may be either a table or query in an Access database, or in the form of an Excel worksheet and that worksheet must be the first sheet in the Excel workbook. If the data is on some other sheet, you can easily move that sheet so that it is the first sheet in the workbook by clicking on the sheet tab and dragging it to the left.  For the Chart Merge utility, see the Mail Merging with Charts document that is included in the Merge Tools Add-in Zip file for additional requirements for the data source for use with that utility

●    For a data source in the form of an Excel worksheet, the field names must be in the first row of the worksheet and there must be a field name in all of the cells in that row that are within the range of columns that contain the data.

●    For both types of data source, the field names must contain only alphanumeric characters (No @,#,$,%,&,(,), etc) and the field names must not start with a numeric character (0-9). The number of characters in the field names, including spaces, must not be more than 40.

For a demonstration of the use of the facility, see

https://www.youtube.com/watch?v=yj_s3cdfVDY

Was this answer helpful?

0 comments No comments

Answer accepted by question author

Paul Edstein 82,861 Reputation points Volunteer Moderator
2020-05-16T23:15:04+00:00

Because this is a directory with a lot of personal information, I was editing the data file to remove personal information and shortening the base document, which is 26 pages before doing the merge, and I discovered what is happening. 

I still don't know why or how to fix it, ...

That is, if the names start on page 24 of the original document, what should have happened is that page 24 of the output document would have:

name1

address1

other data1

name2

address2

other data2

name3

address3

other data3

and so forth..

You should do a directory merge with a document containing just the mergefields, then insert the output from that into the document containing the preceding 23 pages.

Was this answer helpful?

0 comments No comments

8 additional answers

Sort by: Most helpful
  1. Paul Edstein 82,861 Reputation points Volunteer Moderator
    2020-05-16T05:31:08+00:00

    Your problem description suggests you did a test merge of just one record, then forgot to reset the output to 'All'

    There is nothing about your field coding that would cause only one record to be processed. It could be improved, though. For example:

    {MERGEFIELD SQ_Rank \f " "}{MERGEFIELD First_Name} {MERGEFIELD Last_Name } {MERGEFIELD Grade} {MERGEFIELD Certificate}                                                 {MERGEFIELD MM}{={MERGEFIELD MM}-1 # "'Merit Marks Since';'Member Since';'Merit Mark Since'"} {MERGEFIELD Cert_Date}

    {MERGEFIELD Home_Phone \b "Ph: "}                              {MERGEFIELD Email \b "Email: "}

    {MERGEFIELD Bus_Phone \b " Work: "}                            {IF{MERGEFIELD Senior}<> "" "Senior Member" }{IF{MERGEFIELD Life}<> "" "Life Member" }

    {MERGEFIELD Address_1}                                                 {MERGEFIELD Spouse \b "Mate: "}

    {MERGEFIELD City} {MERGEFIELD State}{MERGEFIELD Zip_Code}

    {MERGEFIELD Boat_Name} {MERGEFIELD Boat_Type}

    {={MERGEFIELD S} # "'Seamanship';;"}  {={MERGEFIELD P} # "'Piloting';;"}

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments
  2. LemP 74,945 Reputation points Volunteer Moderator
    2020-05-16T04:13:50+00:00

    Thanks for quoting that unhelpful article verbatim.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2020-05-16T01:14:12+00:00

    Hi LemP,

    I'm Jen , an Independent Advisor and a Microsoft Consumer like you. Thank you for reaching out

    If the merge fields appear inside braces, such as { MERGEFIELD City }, then Word is displaying field codes instead of field results. This doesn't affect the merge, but is difficult to format. Right-click the field code, and select Toggle Field Codes on the shortcut menu.

    Please check this link, https://support.microsoft.com/en-us/office/crea...

    Hope this helps.

    Best regards,

    Jennifer A.

    Was this answer helpful?

    0 comments No comments