Sign in with Microsoft
Sign in or create an account.
Select a different account.
You have multiple accounts
Choose the account you want to sign in with.

In a merged document, the MergeRec field displays the ordinal position of the current data record. The number reflects any sorting or filtering that you applied to the data source before the merge. You can use the MergeRec field to number each merged document in a mail merge, in the order that you sorted the data source.

For example, if a personnel database contains 2,000 records, the values of the MergeRec fields would range from 1 to 2,000. However, to send a form letter to employees who reached their five-year anniversary with your company, you would filter the data source, yielding a much smaller set of records, such as 500.

If you used the entire database in the merge, the MergeRec value in a particular employee's letter could be 1,000. With the filter in effect, however, that same employee's MergeRec value would not exceed 500.

The value of the MergeRec field for a data record is also affected by the sort order of the data source. For example, if you sort your mailing list alphabetically in ascending order, a name that begins with A has a low MergeRec number. However, if you sort the same list alphabetically in descending order, the same name has a higher MergeRec number.


When you view the MergeRec field in your document, the syntax looks like this:


Note:  A field code tells the field what to show. Field results are what’s shown in the document after having evaluated the field code. To toggle between viewing the field code and the field code results, press Alt+F9.


You can use the MergeRec field in a document or as part of a mail merge.

To use the MergeRec field in a document, do the following:

  1. On the Insert tab, in the Text group, click Quick Parts, and then click Field.

  2. In the Field names list, select MergeRec.

  3. Click OK.

To use the MERGEREC field as part of a mail merge, while you are setting up the mail merge, do the following:

  • On the Mailings tab, in the Write & Insert Fields group, click Rules, and then click Merge Record #.


The following example uses a MergeRec field next to a Printdate field to create unique invoice numbers. When the main document is merged with the data source, the number that results from the MergeRec field is appended to the numbers that represent the date and time that the invoices are printed.

Invoice Number: { PRINTDATE \@ "MMddyyyyHHmm" }{ MERGEREC }

For the twelfth invoice, printed at 9:46 on Feb. 13, 2007, the document looks like this:

Invoice Number: 02132007094612

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.

Was this information helpful?

What affected your experience?

Thank you for your feedback!