Link to home
Start Free TrialLog in
Avatar of Computer Guy
Computer Guy

asked on

Mail Merge With Word

Hi,

I have an excel spreadsheet

Column A is the section. There are 2 values for the section P and W. I want the names with section P to be one area and the names with section W in another.

I tried using some mail merge rules: Next Record If

Next Record If Not Blank and Section Equal To P

When I do this, it shows all of the records in the P section, not separated.
Word-Demo.docx
Excel-Demo.xlsx
Should-Look-Like.docx
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

You want to group the items according to your 'Section' column You are basically doing a one-to-many Mail Merge. That functionality is not built in to Word. However Microsoft suggest a way of doing it using a directory type of merge in this article: http://support.microsoft.com/kb/294686.

This is what the fields would look like in your case:

{ IF { MERGESEQ } = "1" "{ MERGEFIELD SECTION }¶
" "" }{ SET Place1 { MERGEFIELD SECTION }}¶
{ If { Place2 } <> { Place1 }"¶
{ MERGEFIELD SECTION }¶

{ MERGEFIELD FIRST } { MERGEFIELD LAST }" "{ MERGEFIELD FIRST } { MERGEFIELD LAST }" }{ SET Place2 { MERGEFIELD SECTION }}

There are other ways, mainly using VBA which I suggest in this question:
https://www.experts-exchange.com/questions/23658368/Doing-a-mail-merge-with-section-breaks-using-a-specific-value.html
This is an update of what the fields would look like for your data.

{ IF { MERGESEQ } = "1" "Section { MERGEFIELD SECTION }"
 "" }{ SET Place1  { MERGEFIELD SECTION }}
{ If { Place2 } <> { Place1 }
"Section { MERGEFIELD SECTION }
{ MERGEFIELD FIRST } { MERGEFIELD LAST }" "{ MERGEFIELD FIRST } { MERGEFIELD LAST }" }{ SET Place2 { MERGEFIELD SECTION }}

There is an article here that has some VBA code to convert the text simulation of the Word field code display (as above) to actual Word fields. You might find it useful here.
Avatar of Computer Guy
Computer Guy

ASKER

Do you have any already put together solutions I can build off of?
ASKER CERTIFIED SOLUTION
Avatar of GrahamSkan
GrahamSkan
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial