Mail merge with varying number of records



I am a teacher and we are generating report cards where some of the students do more than the required number of subject. Some students do 10 subjects, some do 11 or even 9. The common value is the students name. I have an excel back end with all the information.

How do I create a report card using mail merge when the number of subjects differs for each student. In other words, the mail merge must be dynamic, only showing the subject each student takes.

I have seen videos using grouping by Chris Menard these videos were recorded a long time ago - is there anything more recent in office 365?


Word Management
Word Management
Word: A family of Microsoft word processing software products for creating web, email, and print documents.Management: The act or process of organizing, handling, directing or controlling something.
900 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Paul Edstein 171 Reputation points

    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:
    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.

    Depending on what you're trying to achieve, the field coding for this can be 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:

    Another option would be to use a DATABASE field in a normal ‘letter’ mailmerge main document and a macro to drive the process. An outline of this approach can be found at:
    Conversely, if you're using a relational database or, Excel workbook with a separate table with just a single instance of each of the grouping criteria, a DATABASE field in a normal ‘letter’ mailmerge main document could be used without the need for a macro. An outline of this approach can be found at:
    For some working examples, see:
    (the second of these uses a macro to apply some additional formatting).

    The DATABASE field can even be used without recourse to a mailmerge. An example of such usage can be found at:

    Alternatively, you may want to try one of the Many-to-One Mail Merge add-ins, from:
    Graham Mayor at ; or
    Doug Robbins at!566

    1 person found this answer helpful.
    0 comments No comments

  2. Charles Kenyon 2,581 Reputation points

    This would be a Directory/Catalog merge. Here is a tutorial.

    Mail Merge has not changed in more than 20 years except for adding the Ribbon user interface so the video is likely accurate.

    You can use IF fields to blank or eliminate lines when a field is blank.
    { IF { MergeField Subject09 } > "" "the text you want on the line here including mergefields" }

    Here is my documentation on the IF Field:
    Here is Microsoft's documentation:

    0 comments No comments

  3. Anonymous


    Im going to look into a Power Automate solution for this. Thank you for the responses and apologies for the delay in my response