Formatting Issues

Fix Social Security Number Formatting in Word Mail Merge

Phi Hung VoPhi Hung Vo Oct 29, 2026 868 views

Question details

The user needs to correctly format Social Security numbers in a Word mail merge so that only the last four digits display consistently.

How to Fix Social Security Number Formatting in Word Mail Merge
Product
Microsoft Word
Device & OS
not provided
Scenario
Performing a mail merge where the source data contains inconsistently formatted Social Security numbers (e.g., varying use of hyphens).
Observed behavior
Word fails to properly format or display just the last four digits due to inconsistencies and hyphens in the original Excel data source.
Before you start

Make sure to create a backup copy of your Excel data source workbook before using Find and Replace to modify data.

Solution 1Recommended

Clean Source Data in Excel and Apply Field Codes

Remove hyphens and inconsistent formatting from your Excel data source so Word can process the numbers and field codes correctly.

Inconsistent formatting, such as scattered hyphens in a Social Security number column, prevents Word from reliably applying numeric field codes. The most reliable method is to normalize the data in Excel first.

1
Copy Records via Directory Merge

If you cannot edit the source application directly, open Word, create a 'Directory' type mail merge document, and insert your fields to generate a raw table of all records.

2
Clean Data in Excel

Copy the generated table into Excel. Select the Social Security number column, press Ctrl+H to open Find and Replace, enter a hyphen (-) in the 'Find what' field, leave 'Replace with' blank, and click 'Replace All'.

3
Extract the Last Four Digits

To easily display only the last four digits, create a new column in Excel next to your SSN data. Use the formula =RIGHT(A2, 4) (replace A2 with your SSN cell) and drag it down to apply to all rows.

4
Update Mail Merge Source

Save this cleaned Excel workbook. Return to your Word mail merge document, select 'Use an Existing List' to connect your new workbook, and insert the newly created 4-digit merge field.

Clean Source Data in Excel and Apply Field Codes
Tip on Third-Party Applications: If a third-party application automatically executes the merge and overrides your field codes, contact the application's developer to request a built-in toggle for the last four digits.
Seamless Mail Merge Processing

Manage Mail Merges and Data Formatting Easily with WPS Office

WPS Office offers a fully integrated Mail Merge feature across WPS Writer and WPS Spreadsheet. You can effortlessly clean inconsistent data, remove unwanted characters, and perform a precise mail merge to display exact outputs like the last four digits of an SSN.

  1. 1. Clean Data in WPS Spreadsheet: Open your data file in WPS Spreadsheet, select the SSN column, and use the 'Find and Replace' tool to remove all hyphens instantly.
  2. 2. Extract Final Digits: In a new column, use the =RIGHT(cell, 4) formula to isolate the last four digits of the Social Security numbers.
  3. 3. Launch Mail Merge: Open your template in WPS Writer, go to the 'References' tab, and click 'Mail Merge' to connect your updated Spreadsheet.
  4. 4. Complete the Merge: Click 'Insert Merge Field', add the column containing the final four digits, and click 'Merge to New Document' to finish.
Fully compatible with Microsoft Word and Excel formats (.docx, .xlsx).Intuitive Find and Replace tools in WPS Spreadsheet for quick data normalization.Streamlined Mail Merge wizard in WPS Writer with advanced field code support.Lightweight, fast, and completely free to use for everyday office tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't Word display my Social Security numbers correctly in mail merge?

Word imports raw data from Excel exactly as it is stored. If your Excel column contains a mix of text, numbers, and hyphens, Word cannot uniformly apply a numeric formatting switch. Cleaning the data in Excel first ensures Word reads it as a consistent value.

Can I format Social Security numbers using just Word field codes?

Yes, if your Excel data consists of pure 9-digit numbers (no hyphens), you can right-click the merge field in Word, select 'Toggle Field Codes', and add the switch \# "###-##-####" to format it. However, this fails if the source data already has text characters or hyphens.

What is the easiest way to show only the last 4 digits of an SSN?

The most fail-proof method is modifying the Excel data source. Add a new column and use the formula =RIGHT(A2, 4) (where A2 is the SSN). Then, use this new column as your merge field in Word instead of struggling with complex field codes.

What is a Directory mail merge in Word used for?

A Directory mail merge (previously known as a Catalog merge) generates a single continuous document or table listing all records sequentially. It is highly useful for extracting, cleaning, or auditing a large dataset before finalizing letters or labels.