How to Group Records by State and City in Word Mail Merge
Question details
The user needs to perform a many-to-one mail merge to summarize approximately 200 records grouped by state and city without inserting page breaks.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Creating a consolidated directory or report using a sorted source spreadsheet, where entries are grouped under state and city headings on a continuous page.
- Observed behavior
- The MergeSeq field and conditional IF field formulas are not producing the expected grouping results, and unwanted extra paragraph marks appear in the output.
Ensure your source spreadsheet is strictly sorted by your grouping categories—first by State, then by City, and finally by Name—before importing it into your document.
Execute Finish & Merge to Evaluate MergeSeq Correctly
Word's MergeSeq field and complex conditional formulas do not calculate their final values during the Preview Results stage. You must complete the merge to see the correct output.
When building a many-to-one mail merge, the sequence and conditional logic require the document to be fully processed. Relying on 'Preview Results' will often display inaccurate formatting and sequencing.
Click on the 'Mailings' tab in the top ribbon menu after setting up your IF fields and MergeSeq codes.
Click the 'Finish & Merge' button located at the far right of the Mailings ribbon.
Choose 'Edit Individual Documents' and select 'All' to generate the final merged document, which will properly calculate the MergeSeq fields and conditional grouping.

Format Conditional IF Fields to Prevent Blank Lines
Adjust the placement of paragraph marks inside your IF field brackets to prevent unwanted blank lines when records are suppressed.
Use a Specialized Many-to-One Add-in
For complex multi-level grouping (State > City > Name), native Word field codes can be highly prone to formatting errors. A specialized add-in simplifies this.
Perform Mail Merges Easily with WPS Office
If complex field codes are slowing you down, try WPS Office. It provides an intuitive Mail Merge feature and a built-in spreadsheet editor, making it easier to manage your data and generate perfectly formatted documents.
- 1. Open WPS Writer: Launch WPS Writer and navigate to the 'References' tab on the top ribbon, then click 'Mail Merge'.
- 2. Import Your Data: Click 'Open Data Source' and select your pre-sorted spreadsheet containing the State, City, and Name data.
- 3. Insert Merge Fields: Click 'Insert Merge Field' to place your data points exactly where you need them in the document layout.
- 4. Generate Document: Click 'Merge to New Document' to finalize the process and review your completed data list.

Frequently Asked Questions
Why isn't my MergeSeq field updating correctly in the preview mode?
The MergeSeq field relies on the actual execution of the mail merge to sequence records properly. It will not display accurate results in 'Preview Results' mode. You must use 'Finish & Merge' to view the true output.
How do I remove extra blank lines in a grouped mail merge?
Extra paragraph marks occur when conditional IF fields suppress text but leave the paragraph return intact. To fix this, toggle your field codes (Alt+F9) and ensure the paragraph return (Enter) is placed inside the conditional quotes, not outside.
Do I need to sort my Excel data before running a grouped mail merge?
Yes. Word reads data sequentially row by row. For conditional IF fields to detect category changes properly, your source spreadsheet must be strictly sorted by your primary group (State) and then your secondary group (City) before starting the merge.




