Mail Merge from Excel to Word Breaking to new document based on column entry

cheesiepoof05

Board Regular
Joined
Dec 30, 2010
Messages
82
Hello all,

I am working on creating a mail merge document process from Excel to Word that splits based off of a 1 indicator in a certain column. Certain fields need listed all under the same document but change in length for row count. I thought it might be easier to create a short sample of what I'm doing. So the example below would create three different documents. With each one listing the class at the top and then a list of Animals and Colors below it. I appreciate your help. I'm trying to avoid any 3rd party addins if at all possible, but wasn't sure if Excel/Word had this ability inherently. Thanks!


File_Name
New_Record
Class
ANIMAL
COLOR
MAMMALS - 20170419
1
MAMMALS
DOG
BROWN
MAMMALS - 20170419
MAMMALS
MOOSE
BROWN
MAMMALS - 20170419
MAMMALS
MOOSE
GRAY
MAMMALS - 20170419
MAMMALS
RABBIT
WHITE
MAMMALS - 20170419
MAMMALS
ZEBRA
STRIPE
BIRDS - 20170419
1
BIRDS
CARDINAL
RED
BIRDS - 20170419
BIRDS
BLUE JAY
BLUE
BIRDS - 20170419
BIRDS
WOOD PECKER
BROWN
REPTILES - 20170419
1
REPTILES
LIZARD
GREEN
REPTILES - 20170419
REPTILES
SNAKE
YELLOW
REPTILES - 20170419
REPTILES
KOMODO
GREEN
REPTILES - 20170419
REPTILES
CHAMELEON
MIXED

<tbody>
</tbody>


<tbody>
</tbody>


Mail Merge Sample (please note while the list part doesn't appear to be in a grid, I will need it to be.)
For the animal class of «CLASS»
«ANIMAL»
«Color»

<tbody>
</tbody>



Mail Merge Sample for first document

For the animal class of MAMMALS
DOG
Brown
MOOSE
Brown
MOOSE
Gray
RABBIT
White
ZEBRA
Striped

<tbody>
</tbody>
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
You can use Word's Catalogue/Directory Mailmerge facility for this (the terminology depends on the Word version). To see how to do so with any mailmerge data source supported by Word, check out my Microsoft Word Catalogue/Directory Mailmerge Tutorial at:
Microsoft Word Catalogue/Directory Mailmerge Tutorial | Windows Secrets Lounge
or:
http://www.gmayor.com/Zips/Catalogue Mailmerge.zip
The tutorial covers everything from list creation to the insertion & calculation of values in multi-record tables in letters. Do read the tutorial before trying to use the mailmerge document included with it.

The field coding for this is complex. However, since the tutorial document includes working field codes for all of its examples, most of the hard work has already been done for you - you should be able to do little more than copy/paste the relevant field codes into your own mailmerge main document, substitute/insert your own field names and adjust the formatting to get the results you desire. For some worked examples, see the attachments to the posts at:
mail merge with duplicate names but different dollar amounts
Access to Word, Creating a list from multiple records
Word 2010 Merge from excel into Table Directory | Windows Secrets Lounge

Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An example of this approach can be found at: http://answers.microsoft.com/en-us/...g-tables/8bce1798-fbe8-41f9-a121-1996c14dca5d
The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: Mail merge into different coloumns

Although none of the above specifically creates a new document at each break, post-merge you could run the Split Merged Output to Separate Documents macro in the Mailmerge Tips and Tricks thread at:
http://www.msofficeforums.com/mail-merge/21803-mailmerge-tips-tricks.html
or:
http://windowssecrets.com/forums/showthread.php/163017-Word-Mailmerge-Tips-amp-Tricks
If you use the DATABASE field approach, the macro that drives that could be combined with the Send Mailmerge Output to Individual Files macro code in these last two links to generate separate documents for each group as part of the merge process.

Alternatively, notwithstanding your reservations about 3rd-party addins, you may want to try one of the Many-to-One Mail Merge add-ins, from:
Graham Mayor at http://www.gmayor.com/ManyToOne.htm; or
Doug Robbins at http://bit.ly/1hduSCB

In addition to a 'Many to One' merge, the latter handles:
• Merge with Charts
• Duplex Merge
• Merge with FormFields
• Merge with Attachments
• Merge to Individual Documents
• Merge, Print and Staple
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,998
Messages
6,122,643
Members
449,093
Latest member
Ahmad123098

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top