Skip to content
Tutorials Center
My learning

Topics

Lesson 32 of 42 · Mail Merge, Macros and Automation

Mail Merge in Word

Learn Word mail merge: prepare a data source, insert merge fields, add rules and conditions, preview results, filter recipients and finish to documents or email.

Mail merge produces many personalized copies of one document: invitations with different names, invoices with different amounts, certificates, emails. You write the letter once, keep the changing data in a list, and Word combines them. Two parts are always involved: a main document (the template with placeholders) and a data source (a table with one row per recipient).

flowchart LR
  A["Main document<br/>Dear «First_Name»,"] --> M(("Merge"))
  B["Data source<br/>rows and columns"] --> M
  M --> C["One letter per row"]

The main document holds fixed text and placeholders; the data source supplies the values.

Step 1: Prepare the data

A clean data source saves hours. Use an Excel sheet (or a CSV file, a Word table, an Outlook contact list or a database):

  • First row = column headings, unique, with no merged cells ("First_Name", "Last_Name", "City", "Amount").
  • One record per row, no blank rows or totals underneath.
  • Keep one fact per column (do not combine names and addresses).
  • Format dates and money in Excel the way you want them: Word shows the stored value, and number formatting can be lost (see "Formatting numbers" below). Using text for postcodes keeps leading zeros.
  • Close the Excel file before merging.

Also decide the document type: a Letter, Email, Envelope, Label or Directory (a catalog list where all records follow each other).

Step 2: Start the merge

On the Mailings tab:

  1. Start Mail Merge and choose Letters (or Email Messages, Envelopes, Labels, Directory, Normal Word Document).
  2. Select Recipients > Use an Existing List... and choose the Excel file and sheet. (Or Type a New List... for small jobs, or Choose from Outlook Contacts.)
  3. Edit Recipient List opens a dialog where you can sort, filter, tick or untick records, and Find Duplicates.

The Step-by-Step Mail Merge Wizard (Start Mail Merge > Step-by-Step Mail Merge Wizard) opens a task pane that walks through the same steps, which is helpful the first time.

Step 3: Insert merge fields

Type your letter. Where values should appear, place the cursor and use:

  • Insert Merge Field: pick a column; it shows as «First_Name».
  • Address Block: inserts a formatted address with several fields, with options for country and style.
  • Greeting Line: builds "Dear Mr. Smith," with a fallback such as "Dear Sir or Madam," for blank names. Edit the format in its dialog.

Format a field the way you format text: select «First_Name» and make it bold, and the merged value takes that look. Press Alt+F9 to toggle the display between «First_Name» and the underlying { MERGEFIELD First_Name } code.

If Word cannot match your columns (for example Address and Greeting blocks), click Match Fields to say which of your columns is the "Last Name", "Postal Code", and so on.

Rules and conditions

The Rules drop-down adds logic:

  • If...Then...Else...: show different text depending on a field, for example If Amount > 500 then "Premium member".
  • Ask, Fill-in: prompt for a value at merge time.
  • Next Record and Next Record If: continue to the next record on the same page, for lists.
  • Skip Record If: leave out a row that meets a condition (for instance, Status equals "Unsubscribed").
  • Set Bookmark, Merge Record # and Merge Sequence # for numbering.

You can also hide or show a whole paragraph with an IF field. If the result is empty, it still prints a blank paragraph, so place the field's paragraph mark inside the condition when needed.

Step 4: Preview and finish

Click Preview Results to see the first record, and use the arrows to browse. Find Recipient locates a name. Check for Errors simulates the merge and reports problems.

Finish & Merge gives three options:

  1. Edit Individual Documents... creates a new document with one page per record, that you can scan and edit. Choose All, Current record or a From/To range.
  2. Print Documents... sends them to the printer.
  3. Send Email Messages... (for the Email type) with Outlook: choose the field with the email address (To), a Subject line and the mail format (HTML is the default; Plain text or Attachment).

Always merge to a new document first and review it, before printing or emailing hundreds of copies.

Formatting numbers and dates

Excel might store 1234.5 and show "$1,234.50". Word reads the stored value unless you tell it otherwise. Fix this with a switch: press Alt+F9 and edit the field code.

Field code Result
{ MERGEFIELD Amount \# "$#,##0.00" } $1,234.50
{ MERGEFIELD Date \@ "MMMM d, yyyy" } March 5, 2026
{ MERGEFIELD Name \* Upper } ANA GARCIA
{ MERGEFIELD Name \* Caps } Ana Garcia

A more robust fix is to turn on Confirm file format conversion on open and choose OLE DB or DDE in the open dialog, or to format the Excel column as Text. Excel text columns merge exactly as shown.

How a merge works

A merge replaces each placeholder with the value from the current row, then repeats for every row. This stand-in does the same with Python's standard library. It uses an IF rule, a number format, and skips records, like Word's rules. It is not Word's engine.

Python Mail merge in miniature (stand-in)

Press Run (or Ctrl + Enter) to see the result here.

Program input · what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Merge into email

Choose Email Messages as the type. The data source needs an email column. After Finish & Merge > Send Email Messages, Word uses Outlook to send each message separately: recipients do not see each other. Check your organization's limits on bulk sending and make sure recipients agreed to receive your messages. Test with your own address first.

Merging attachments per recipient needs a macro or a service. A common workaround is putting a personal link in the data (in a column "Link") and inserting it as a merge field in the email. A hyperlink merge field needs the HYPERLINK field: { HYPERLINK "{ MERGEFIELD Link }" }, created with Ctrl+F9 for the braces.

Troubleshooting

  • Data shows as zeros or wrong decimals. Use the numeric switch or text formatting.
  • Blank lines in addresses. Use Address Block, or Skip Record If or IF fields around optional lines.
  • Only the first record is formatted. Format the field in the main document, then click Update Labels for label layouts.
  • Merged document is large. Ten thousand pages is normal; split by ranges.
  • Word cannot find the data source. Keep the Excel file in the same location and not open elsewhere.
  • The sheet name has a space. Word still handles it, but a named range avoids problems.

See also Envelopes and Labels and the project A Form Letter Merge.

Check your understanding

Quick check · 4 questions

of 4 answered You scored / 4 · perfect!

  1. 1. What are the two main parts of a mail merge?

    The main document holds the fixed text and fields, and the data source holds the values.
  2. 2. Which button shows or hides the field codes such as MERGEFIELD?

    Alt+F9 toggles field codes for all fields.
  3. 3. How do you display a merged amount as $1,234.50?

    Field switches control how numbers and dates are shown.
  4. 4. What is the safest first finishing step?

    Merging into one new document lets you check the output before printing or sending.

Summary

  • A merge combines a main document with a data source, one record per row.
  • Prepare clean data: headings in row 1, no blanks, text format where needed.
  • Insert fields, Address Block and Greeting Line; add rules for conditions.
  • Preview, check for errors and merge to a new document first.
  • Use field switches for number and date formats.

Next: Envelopes and Labels