Working with the mail merge feature in Microsoft Word is a time-saving option to create repetitive, custom-tailored documents from letters to contracts to emails to labels and more. Whether you are bringing data in from an Excel worksheet, an Access database, or a Word table, you may sometimes want the flexibility of applying different or consistent formatting to text or date fields as you reference them throughout your mail merge documents. For instance, a text field such as a project title or vendor name may be used in a variety of documents in various formats such as UPPER CASE or lower case. Or, perhaps you want to change the display of date merge fields, especially if the original date is not merging with the correct format. Fortunately, there are options to customize the format of date or text fields without creating multiple versions in the original data source.
How can you apply custom text or date formats to a mail merge field to accurately display the formatted text in a Word mail merge main document? The solution is to add a mail merge switch to the mail merge code or MERGEFIELD instruction. Try this formatting fix on letters, emails, and other documents that link to mail merge data from Excel, Word, or Access.
Let’s look at the steps. In this sample letter, the Company field is a merge field from a linked recipient list. When the results are previewed, the company name displays as it was originally entered. With a simple edit, the field can be changed to display the case formatting you want in the document, such as all upper case.
Formatting a Date or Text Mail Merge Field
To apply custom formatting to a date or text mail merge field:
- Select the mail merge field, such as Company, as shown in this example.
- Press [Alt] + F9 to reveal the field coding. Or, right-click on the field and choose the Toggle Field Code option. You should now see the actual field code for the field, which should look something like { MERGEFIELD Company }.
- Edit the field by inserting a switch code to the end of the field. For instance, to apply a text format to change to upper case, edit the field to show as { MERGEFIELD Company \*Upper } (see other examples of text and date formatting below).
- Press [Alt] + F9 again.
- Position the cursor anywhere in this field and press the [F9] function key to update it. Or, right-click the field and choose Update Field.
- Preview the results to confirm the merge field displays with the formatting you want to see in the document for each of the mail merge records. For this example, the name will display as COMPANY NAME.
- Run the mail merge.
Options for the Text Mail Merge Field Switch
To apply text formatting, use the text format switch \* followed by the desired expressions for the case.
Word Result | Field Code | Desired Result | Displayed Result |
UPPER CASE | { MERGEFIELD Name \*Upper } | Capitalizes all letters | MICROSOFT WORD IS AMAZING! |
lower case | { MERGEFIELD Name \*Lower } | Transforms all letters to lower case | microsoft word is amazing! |
Title Case | { MERGEFIELD Name \*Caps } | Capitalizes the first letter of each word | Microsoft Word Is Amazing! |
Sentence case | { MERGEFIELD Name \*Lower \*FirstCap } | Capitalizes only the first letter of the first word (use both switches shown) | Microsoft word is amazing! |
Note: the switches are not case-sensitive.
Options for the Date Mail Merge Field Switch
To apply custom date formatting to a date mail merge field, use the date-time format switch \@ and add the desired expressions for the day, month, and year in double quotes (see examples below).
Switch | Description |
---|---|
yyyy | Year. Use yy to display the last two digits of any year. Use yyyy to display all four digits of any year. |
M | Month. Use MMMM to fully spell out the month (such as September or October). Use MMM to display the three-letter abbreviation for the month (such as Sep, Oct). Use MM to display the month in two digits with a leading zero for single-digit months (such as 09, 10). Use M to display the month in digits (such as 9, 10). |
d | Day. Use dddd to spell out the day of the week (such as Sunday or Monday). Use ddd to display the three-letter abbreviation of the day ( such as Sun, Mon). Use dd to display the day in two digits with a leading zero for single-digit days ( such as 09, 10). Use d to display the day in digits ( such as 9, 10). |
Note: The d, M, y expressions can be arranged in different orders, but the usage of the upper case “M” for months is important as the lower case “m” is used for minutes. It is also possible to add text (such as /, -, …) and spaces; just make sure the added text remains within the double quotes.
Date Formatting Examples
Field Code | Displayed Results | |
{ MERGEFIELD Date \@ “dddd, MMMM d, yyyy” } | Saturday, July 9, 2022 | |
{ MERGEFIELD Date \@ “MM/dd/yyyy” } | 07/09/2022 | |
{ MERGEFIELD Date \@ “M-d-yy” } | 7-9-22 | |
{ MERGEFIELD Date \@ “MMMM d, yyyy” } | July 9, 2022 |
Adding Font Formatting to Mail Merge Fields
If you’d like to format mail merge fields with bold, italics, or font color, you don’t need to customize the merge code. Simply highlight the entire merge field and apply the formatting from the Microsoft Word Home tab in the Ribbon.
Try these options for formatting date and text mail merge fields to get the results you want in your documents. And learn more about the numeric switches available to control the formatting of Excel or other numeric mail merge data.
Discover more ways to save time editing and formatting your Word documents at TheSoftwarePro.com/Word.
© Dawn Bjork, MCT, MOSM, CSP®, The Software Pro®
Microsoft Certified Trainer, Productivity Speaker, Certified Speaking Professional