Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-26-2016, 01:12 PM
eduams eduams is offline Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Windows 7 32bit Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Office 2013
Novice
Excel / Mail Merge - Return Column Headers for All and Any Columns with Values
 
Join Date: Sep 2016
Posts: 1
eduams is on a distinguished road
Default Excel / Mail Merge - Return Column Headers for All and Any Columns with Values

Hi All

I am looking for a solution to the following problem:
...I need to create a mail merge of all students with grades in subjects they study for only. If they study for those subjects then i want to return the subject and grade under each students name. If they don't study for any subject, then i don't want to see the subject listed at all...e.g.:
[originally posted here [URL="http://www.mrexcel.com/forum/excel-questions/966936-excel-mail-merge-return-column-headers-all-any-columns-values.html"]

..so the final outcome should be a single page with customized headers and merged fields like:

Name: Mar
Subjects:
Science Term 1: 72
Science Term 2: 47


Science Term 3: 18Maths Term 2: 44
_________________________________next student record

many thanks for your help
Reply With Quote
  #2  
Old 09-26-2016, 07:02 PM
macropod's Avatar
macropod macropod is offline Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Windows 7 64bit Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Assuming your data has a separate record (e.g. Excel row) per subject for student, 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:
http://windowssecrets.com/forums/sho...merge-Tutorial
or:
http://www.gmayor.com/Zips/Catalogue%20Mailmerge.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:
https://www.msofficeforums.com/mail-...html#post23345
https://www.msofficeforums.com/mail-...html#post30327
http://windowssecrets.com/forums/sho...l=1#post928391

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/o...1-1996c14dca5d
The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at: https://www.msofficeforums.com/mail-...html#post67097

Alternatively, 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

Alternatively, if it's just a matter of having separate fields (e.g. Excel columns) and a single record per student, you can use a normal merge and line suppression for empty lines, as described in the Mailmerge Tips and Tricks 'Sticky' thread at the top of this forum: https://www.msofficeforums.com/mail-...ps-tricks.html
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply

Tags
columns, merge



Similar Threads
Thread Thread Starter Forum Replies Last Post
Return Address mail merge GeorgeLawshe Mail Merge 2 06-03-2016 11:04 AM
Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Merge table cells across columns but skip if column don't exist jhearing Word Tables 4 05-31-2016 06:20 AM
Formula/function to return column names for matching values GiJoe81 Excel 1 06-27-2015 12:13 AM
Mail merge how to link mail merge field value to a column heading dsummers Mail Merge 1 05-08-2014 02:59 PM
Excel / Mail Merge - Return Column Headers for All and Any Columns with Values Word 2010 and Excel 2010 Mail merge - multiple headers robby Word 3 04-18-2012 06:37 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:12 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft