Document Editing Problems

Create Conditional Tables in Microsoft Word Mail Merge

Jason MillerJason Miller Nov 20, 2026 870 views

Question details

Create a mail-merge table with fixed columns and conditional rows, optionally including images associated with row text.

Create Conditional Tables in Word Mail Merge
Product
Microsoft Word
Device & OS
not provided
Scenario
A mail-merge document needs a table whose number of rows depends on merge-field values.
Observed behavior
The desired output is a table with the appropriate rows and related images for each merged result.
Before you start

Check whether the conditional rows belong to one data-source record or whether each row comes from a separate record. Prepare sample records covering the different combinations of rows and any image paths you intend to use.

Solution 1Recommended

Use IF fields to select a complete table for each record

Use this approach when all conditional rows belong to the same merge record.

Create a complete table variant for each relevant combination of conditions, keeping the columns consistent. Nested IF fields can select the appropriate variant; this can become difficult to maintain when there are many combinations.

A macro is not required for this approach. Test complex table and image fields with representative records before running the full merge.

1
Connect the data source

In Word, open the merge document and choose Mailings > Select Recipients to connect the source containing the condition fields.

2
Prepare table variants

Use Insert > Table to create the required versions of the table, including only the rows appropriate to each condition combination. Use Mailings > Insert Merge Field to add the related text fields.

3
Set up conditional selection

On the Mailings tab, use Rules > If...Then...Else to compare a merge field with the value that controls a table variant. For multiple conditions, use nested IF fields so each final result contains the complete matching table rather than an isolated row.

4
Add and test images

Where a table variant needs an image, use Insert > Pictures to add it or a linked picture. Use Mailings > Preview Results to check several records, then choose Finish & Merge > Edit Individual Documents and verify that the tables and images appear as intended.

Use IF fields to select a complete table for each record
Linked images may need extra handling: If image paths vary by record, image fields may need to be updated after the merge. Test the finished document because linked-image behavior can vary with the field setup.
Free Microsoft Office alternative

Edit Mail-Merge Documents with WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and Microsoft Office format compatibility, making it easier to move and edit existing documents. It does not fix Microsoft Word's conditional merge behavior.

Edit documents containing tables in a familiar word-processing interfaceOpen and save Microsoft Word DOC and DOCX filesWork with Microsoft Excel XLS and XLSX data-source filesMove everyday Office documents into a lightweight suite
QA img-9

Frequently Asked Questions

Do I need a macro to create conditional tables in Word?

Not necessarily. If all the conditions come from one merge record, nested IF fields can select among complete table variants. Use Mailings > Rules > If...Then...Else to start setting up the conditions.

When should I use a Directory merge instead?

Use Mailings > Start Mail Merge > Directory when each desired row comes from a separate data-source record. Check the merged output because the document layout can produce separate one-row tables.

Can conditional table rows include images?

Yes. Add pictures to the relevant table variants through Insert > Pictures. If images are linked or their paths vary by record, test the completed merge and update image fields if needed.

How can I check the table before merging all records?

Use Mailings > Preview Results to inspect representative records, then select Finish & Merge > Edit Individual Documents to verify the final tables and images.