How to Format Multiple Mail Merge Fields with Commas and 'And'
Question details
The user needs to dynamically combine three Excel fields in a mail merge document to form a grammatically correct list using commas and the conjunction "and" based on field availability.

- Product
- Word
- Device & OS
- not provided
- Scenario
- Creating a customized mail merge document where the punctuation dynamically adjusts depending on whether the second and third fields contain data.
- Observed behavior
- The user wants the mail merge result to change punctuation automatically, displaying commas and "and" only when the respective optional fields are populated.
Ensure your spreadsheet data source is properly connected to your document and that you know the exact header names for the fields you intend to merge.
Use Nested IF Fields for Dynamic Punctuation
Utilize nested IF formula fields to check for blank fields and automatically apply the correct punctuation and conjunctions.
To achieve grammatically correct lists, you cannot simply place commas between merge fields. By using nested IF statements, the document can evaluate whether a field contains data and conditionally insert the necessary commas and spaces.
Press Alt + F9 on your keyboard to toggle the display of field codes in your document.
Use the 'Insert Merge Field' button to add your first required field, which will always display.
Press Ctrl + F9 to insert a blank field bracket { }. Do not type the curly braces manually, as they will not function as code.
Inside the brackets, type your conditional logic. For example: { IF { MERGEFIELD Field3 } <> "" ", and { MERGEFIELD Field3 }" "{ IF { MERGEFIELD Field2 } <> "" " and { MERGEFIELD Field2 }" "" }" }. Replace Field2 and Field3 with your actual field names.
Ensure you include the required blank spaces immediately after commas and before the word 'and' directly inside the quotation marks of your IF fields.
Press Alt + F9 again to hide the field codes, then click 'Preview Results' in your Mailings ribbon to verify the dynamic punctuation.

Create Advanced Mail Merges Effortlessly with WPS Office
WPS Writer offers full compatibility with standard field codes and advanced mail merge features, making it easy to generate dynamic, grammatically correct letters from your spreadsheet data.
- 1. Connect data source: Open your document in WPS Writer, go to the 'Mailings' tab, select 'Open Data Source', and choose your spreadsheet.
- 2. Insert field codes: Press Ctrl + F9 to insert formula brackets and type your IF statements for conditional formatting.
- 3. Add merge fields: Click 'Insert Merge Field' to place your specific data points within the logical formulas you created.
- 4. Preview and merge: Click 'View Merged Data' to preview how your dynamically formatted commas and conjunctions will look before finalizing the merge.

Frequently Asked Questions
Why are my nested IF fields showing as code instead of the final result?
You likely have field codes toggled on in your document view. Press Alt + F9 (or Option + F9 on a Mac) to toggle between viewing the underlying field codes and the actual merged data results.
What happens if my spreadsheet cell contains a space but no text?
A cell containing a space is not considered strictly blank by mail merge logic. Ensure your spreadsheet data is cleaned and truly empty (containing absolutely no characters or spaces) for the IF statements to trigger the correct punctuation.
Can I use the 'Rules' button instead of manually typing IF fields?
While the 'Rules' drop-down menu offers a basic 'If...Then...Else' option for simple conditions, creating a grammatically correct list evaluating three distinct variables requires manual nesting of field codes using the Ctrl + F9 shortcut.




