Fix Blank Invoice Totals After Next Record Rules in Mail Merge
Question details
The Total Amount and Balance Due fields in a mail merge invoice appear blank when placed after the 'Next Record If' rules, but display correctly if placed before.

- Product
- Word Processor Mail Merge
- Device & OS
- not provided
- Scenario
- Generating invoices with multiple line items using the standard mail merge and 'Next Record' rules.
- Observed behavior
- Fields placed after the 'Next Record' command fail to pull data from the current record and instead output blank values.
Make sure your data source is cleanly formatted and open your mail merge template to locate exactly where your summary fields and 'Next Record' commands are positioned.
Move Total Fields Before Next Record Rules
The most straightforward solution is to rearrange your document template so that summary data is retrieved before the mail merge engine skips to the next data row.
The 'Next Record' command instructs the word processor to immediately advance to the next row in your spreadsheet. Any fields placed sequentially after this command will attempt to pull data from that next row, which may not have the corresponding total or balance data.
Launch your word processor and open the main mail merge document used for your invoices.
Find the 'Total Amount' and 'Balance Due' merge fields that are currently positioned after the 'Next Record' or 'Next Record If' rules.
Select, cut, and paste these total fields so they are placed prior to the 'Next Record' rule within the document layout.
Click 'Preview Results' to confirm that the totals now correctly display the data corresponding to the current invoice record.

Use a Many-to-One Mail Merge Add-in
If your invoices contain multiple detail rows for a single client, standard mail merge may not be sufficient. A many-to-one merge tool correctly groups multiple records into one document.
Create Accurate Invoices Easily with WPS Writer
WPS Office provides an intuitive Mail Merge feature that makes generating invoices, letters, and labels straightforward. With an easy-to-manage visual interface and direct integration with WPS Spreadsheet data sources, you can easily reposition fields and avoid common formatting errors.
- 1. Start Mail Merge: Open WPS Writer, navigate to the 'References' tab, and click on 'Mail Merge' to reveal the merge toolbar.
- 2. Connect Data Source: Click 'Open Data Source' and select your WPS Spreadsheet containing the invoice data and calculated totals.
- 3. Insert Data Fields: Use 'Insert Merge Field' to place your data points accurately, ensuring that your summary totals are placed before any 'Next Record' commands.
- 4. Preview and Complete: Click 'View Merged Data' to instantly preview your invoices, verify that all totals display correctly, and finish the merge.

Frequently Asked Questions
Why does the 'Next Record' rule make my fields blank?
The 'Next Record' command instructs the word processor to immediately jump to the next row in your data source. Any fields placed after this rule will try to fetch data from the subsequent row. If that next row doesn't have the relevant total, or is completely blank, the field will display as blank in your document.
What is a many-to-one mail merge?
A many-to-one mail merge is a technique that allows you to group multiple rows of data (such as multiple items purchased by a customer) into a single document (like one invoice). This relies on a common identifier, like an invoice number, to bundle the records together.
Can I use 'Next Record If' to group multiple invoice items?
While 'Next Record If' can be used to conditionally skip or display records, it is very difficult to build complex invoices with it because it is constrained by standard mail merge limitations. For multiple line items, a dedicated many-to-one merge tool is highly recommended over nested 'Next Record If' rules.




