Add a Conditional Extra Row to a Word Many-to-One Mail Merge
Question details
Add a second table row for a child record only when an additional field contains data in a many-to-one Word merge.

- Product
- Microsoft Word with Graham Mayor's Many-to-One merge add-in
- Device & OS
- not provided
- Scenario
- A many-to-one mail merge groups child records in a table, with an optional field that may require an extra row.
- Observed behavior
- The add-in creates one table row per child record and does not create a second row for the same record based on an IF-THEN condition.
Identify the data source column that determines whether an extra row is needed and decide which values that row should contain. Include test records with both populated and empty values in that column.
Use a custom macro to add conditional rows
Use a customized Word macro when you can adapt the merge process or post-process its output.
The add-in does not create a second row for a record through an IF-THEN rule. A custom macro must identify each record and its optional field value, then add a row only when that value is populated.
Open the data source and the Word merge document. Identify a unique record identifier, the optional field, and where the extra row should appear.
Include the identifier and optional field in the merged output, or arrange for the macro to read them from the data source. The macro needs a reliable way to match each value to its existing table row.
In Word, open Developer > Visual Basic and create a macro tailored to the document and data source, or ask a VBA developer to create one. Have it insert a table row after the matching record only when the optional field is not empty.
Run the merge and macro on the test records, then inspect the output table to confirm that populated fields produce extra rows and empty fields do not.
Explore a customized many-to-one merge method
Use this route if you prefer a different merge process or need help adapting one.
Edit Word Merge Documents with WPS Writer
WPS Office is a free, lightweight alternative for editing Word documents in a familiar interface. Its Microsoft Office format compatibility helps you move documents between applications, though it does not fix the Word add-in's conditional-row limitation.

Frequently Asked Questions
Can an IF-THEN field make the add-in insert a second table row?
No. Graham Mayor's Many-to-One merge add-in uses one table row per child record and does not create another row for the same record through an IF-THEN rule.
What information does a macro need to add the right row?
It needs a way to match each existing table row to its source record, the optional field's value, and the content to place in the new row. A unique record identifier can help establish that match.
How can I test whether the conditional rows work?
Run the merge on a small data set containing both populated and empty optional fields. Check the resulting table to make sure only the populated records receive extra rows.
Where can I ask about customizing Graham Mayor's add-in?
Use the contact page on Graham Mayor's website and provide a sample document, sample data, and an example of the desired table layout.




