How Do I Format Dates and Numbers in a Microsoft Word Mail Merge?

By Ron Price

Formatting codes can be inserted into each mail merge field placeholder to filter the merged data and format it in a particular arrangement.

Things You'll Need

  • Computer
  • Microsoft (R) Word 2002/XP, 2003, 2007
  • Microsoft (R) Excel (optional... used for data source in examples)

Numbers and dates can be problematic in a Microsoft Word Mail Merge, especially when the data source is an Excel workbook. Some issues are more easily solved than others. Numbers without decimal values, such as a five-digit ZIP Code or an integer count, can be converted to text values in Excel. However, to avoid problems with dates and numbers in decimals, you need to insert formatting codes in these merge fields to format these values correctly in the documents produced.


The other document types that can be used as data sources for a Word Mail Merge are:

  •          A single-tier database file
  •          A table from an HTML file
  •          A Microsoft Outlook Address Book
  •          Another Microsoft Word document with a singledata table
  •          A text file with data fields separated by commasor tabs

These document types export values as text.

Merging Integer Numbers

Formatting integers is best performed before importing the source data into Word. This section discusses using Excel.

Step 1

Open the Excel data source workbook and, if there are multiple sheets, click on the tab of the worksheet containing the source data for the Mail Merge.

Step 2

Format integer values as text to avoid merge issues.

Select a column containing integer values. Right-click the selected cells and choose Format Cells from the pop-up menu to display the Format Cells dialog box. Click on the Text selection in the Category list. Click OK to apply the format change. The data in the selected cells is now in text format.

Merging Numbers with Decimal Values

For decimals, you can easily format the number directly in Word.

Step 1

A sample Merge letter showing the embedded merge fields.

To format the number of decimal places in a numeric field, such as currency, percentages or any number with decimal values, add formatting codes to the merge field. Open the Mail Merge document (letter, email, etc.) to display its merge fields, which appear as <>, such as <>, for example.

Choose Toggle Field Codes to display the details of the merge field.

Step 2

The merge field <> merges a currency amount from the data source. Right-click on the <> merge field and choose Toggle Field Codes from its pop-up menu to display its formatting, if any.

Step 3

Examples of merge field codes with no formatting applied.

The <> merge field should now show { MERGEFIELD "Amount" }. No formatting is included for this field. To display the merged data as a currency field, enter "# $,#.00" after the field name in the merge field. The merge field should now contain {MERGEFIELD "Amount" # $,#.00}, where:

  • # - Indicates that formatting follows.
  • $ -  Designates a character to be displayed at the front of the field.
  • , (comma) - Indicates commas are to be inserted, if applicable, in a numeric value.
  • # (number sign) -  Indicates the number of fixed digits to display.
  • .00 - Indicates that a decimal value of two places (in this case) is to be displayed. A number without decimals displays with zeros after the decimal.

Merging Percentages

Actions in Formatting Codes

The merge field formatting code to display a percentage with two decimal places and a percent sign

In some cases, it is necessary to merge a data field before it can be acted upon. The "Pct" field in the example is a case in point. To have this data appear in the merged document as a two-decimal percentage with at least one significant digit and a percent sign, requires two actions.

Step 1

Replace the existing MERGEFIELD statement with the innermost action of the new statement MERGEFIELD "Pct". This statement clause retrieves the data from the data source and makes it available to the remainder of the formatting code. After entering the innermost clause, use the CTRL-F9 keys to enclose the statement in braces.

Step 2

Enter an equal sign ("=") before the statement entered in Step 1. This tells the Merge function that the statement includes an operator. Next enter the remainder of the formatting code, *100 # “#0.00%”, immediately behind the rightmost brace of the inner statement. This clause multiplies the merge value by 100 (to shift the decimal place), formats the value as a two decimal percentage and displays the percent sign. At this point, the merge field should be ={ MERGEFIELD “Pct”}*100 # “#0.00%”. Use CTRL-F9 to enclose the entire statement in braces and active it.

Like any number calculated by a formula in Excel, the raw values may not be limited to only two fixed decimal places, regardless of what displays in the cell. As shown in the previous step, the length of a number, especially any decimals, can be set to a fixed number of positions.

Merging Dates

To merge a date from Excel in the format of M/d/y, for example 6/15/2015, you don't need special formatting. This date format merges as is just fine. However, if you wish to display the date in any other format, such as June 15, 2015, some formatting codes are needed.

To merge a date field and display it as day, month, year, the formatting code is "\@ "MMMM d, yyyy", where "\@" indicates a date format and " MMMM d yyyy" indicates the month in text, the day with no leading zero and the year as a four-digit number

The results of a Mail Merge showing formatted date, currency and percentage fields.


When formatting dates in a Mail Merge, placeholders and format codes for the month use an uppercase "M." Lowercase "m" is used to represent minutes.