How to Group Variable-Length Records in Word Mail Merge
Question details
The user needs to perform a mail merge that groups a variable number of subscription records per dealer, ensuring each dealer's records start on a new page.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Creating a mail merge document where multiple related records must be grouped under a single entity (like a dealer) without breaking tables or creating static fixed-length structures.
- Observed behavior
- A standard mail merge creates one page per record rather than grouping variable amounts of related records on a single page per dealer.
Ensure your data source, such as an Excel spreadsheet, is sorted by the grouping field (like the dealer name or ID) before initiating the mail merge.
Use Directory Mail Merge with Next If Fields
This native Word method allows you to group multiple records onto a single page conditionally.
By changing your document type to a Directory, Word will list records consecutively rather than forcing a page break after each row. You will need to use IF fields to control formatting when the dealer changes.
Open your Word document, go to the Mailings tab, click Start Mail Merge, and select Directory (or Catalogue in older versions).
Insert the merge fields for the dealer and subscription data into your document where you want them to appear.
Click Rules in the Mailings tab and select Next Record If. Configure the rule to compare the current dealer name with the next record so Word knows when to group them.
To ensure each dealer begins on a new page, press Ctrl+F9 to create a field code and write an IF statement that inserts a page break whenever the dealer name changes.

Insert a DATABASE Field for Grouped Records
If Directory merge is too complex, a DATABASE field within a standard Letter merge can fetch and display multiple related records in a dynamically expanding table.
Use a Third-Party Merge Tools Add-in
Utilize a Many-to-One mail merge add-in to easily group records without manually writing complex field codes.
Group Mail Merge Records Easily in WPS Office
WPS Office provides a highly compatible and intuitive Mail Merge feature. You can seamlessly connect spreadsheets to group multiple records, format tables, and export grouped documents with minimal effort.
- 1. Prepare Data in WPS Spreadsheet: Open WPS Spreadsheet and sort your subscription data by the dealer column to ensure groups are ordered correctly.
- 2. Start Mail Merge in WPS Writer: Open WPS Writer, navigate to the Mailings tab, and click Mail Merge.
- 3. Connect Data Source: Click Open Data Source and select your prepared spreadsheet.
- 4. Insert Fields and Rules: Use Insert Merge Field to place your data into the document. Utilize Next Record rules to manage grouping multiple items per page effectively.

Frequently Asked Questions
Why does a standard mail merge create a new page for every single record?
Standard mail merges, like 'Letters', are designed to produce a separate document or page for each row in your data source. To group multiple rows on one page, you must use a 'Directory' (or 'Catalogue') merge type or insert specific Next Record field rules.
How do I force a page break when the dealer changes in a Directory merge?
You can nest an IF field inside your document that compares the current dealer merge field with the previous one. If they differ, the field condition is met and it triggers a manual page break.
Can I use a standard Word table to group records automatically?
Word does not automatically expand a single standard table to fit variable records in a basic mail merge. You must use a DATABASE field pointing to your Excel file to dynamically generate a table of variable length for each group.




