How to Use Multiple Values in a Word Mail Merge IF Field
Question details
The user needs to set up a mail merge that conditionally displays either a simple first name or a full multiline postal address based on the delivery method specified in the data source.

- Product
- Microsoft Word
- Device & OS
- not provided
- Scenario
- Creating mail merge labels where the output format changes depending on a specific data field (e.g., hand-delivered versus postal delivery), which requires multiple values and line breaks.
- Observed behavior
- The user needs to output different multiline address formats based on a field's value using Word's IF field functionality instead of a standard typed IF-THEN-ELSE statement.
Ensure your connected data source (such as an Excel spreadsheet) is properly formatted with clear column headers and distinct values identifying the delivery type for each recipient.
Use Word IF Fields for Conditional Mail Merge Formatting
Use Word's built-in IF field codes to test a specific condition (like delivery method) and output custom address blocks with line breaks accordingly.
Word mail merges rely on specific field codes rather than standard programming logic. To achieve conditional formatting with multiple lines, you must insert the true and false results directly into the field code using proper shortcuts.
Press Ctrl+F9 on Windows (or Cmd+F9 on Mac) to generate the special field code braces { }. Do not type these curly brackets manually using your keyboard, as Word will not recognize them as field codes.
Inside the braces, type 'IF ' followed by your condition. Go to Mailings > Insert Merge Field to insert the field you want to evaluate, then add your rule (e.g., IF «Delivery» = "HAND").
After the condition, type the true result in quotation marks (e.g., "«First_Name»"), followed by a space, and then the false result in quotation marks (e.g., "«Title» «Last_Name»").
To accommodate multiple lines for a postal address, simply press the Enter key to create actual line breaks inside the quotation marks of your false result, inserting additional merge fields as needed.

Nest IF Fields for Additional Conditions
If you have more than two possible delivery types, you can nest multiple IF fields inside each other.
Sort the Recipient List to Group Labels
Group your recipients by delivery type as a workaround to avoid complex field codes altogether.
Simplify Your Mail Merges with WPS Writer
WPS Writer offers a highly intuitive and powerful Mail Merge feature. Whether you are generating labels, letters, or envelopes, WPS Writer makes it easy to insert merge fields, apply conditional rules, and format multiline addresses seamlessly.
- 1. Open WPS Writer: Launch WPS Writer and navigate to the References tab to access the Mail Merge tools.
- 2. Connect Data Source: Click 'Open Data Source' to seamlessly link your existing spreadsheet or database.
- 3. Insert Merge Fields: Use the 'Insert Merge Field' button to place your data points and utilize advanced field codes for customized, conditional multiline layouts.
- 4. Preview and Merge: Click 'View Merged Data' to double-check your formatting, then finalize your document with the 'Merge to New Document' option.

Frequently Asked Questions
Why are my IF field codes showing up as regular text instead of executing?
This happens when the curly braces { } are typed manually on the keyboard. Word requires you to generate field braces using the Ctrl+F9 (Windows) or Cmd+F9 (Mac) shortcut for them to function as executable code.
Can I include line breaks directly inside an IF field result?
Yes. You can insert actual line breaks by pressing the Enter key or adding paragraph breaks directly within the quotation marks of your true or false result blocks in the field code.
How do I edit my field codes after I've created them?
You can toggle between viewing the field codes and their generated results by pressing Alt+F9 on Windows (or Option+F9 on Mac). This reveals the underlying code, allowing you to edit conditions and outcomes easily.
Is it possible to evaluate more than two outcomes in a mail merge?
Yes, by nesting IF fields. You can place a secondary IF field inside the false-result section of your primary IF field to test for a third outcome, and continue nesting for additional conditions.




