Mask a text identifier except its final four
Show only the last four characters, like 012345678 → XXXXX5678.
What you'll make

The formula

| Number | Part | What it does | Result so far |
|---|---|---|---|
| 1 | REPT("X",MAX(0,LEN(A8)-4)) | Writes one X for each character before the last four. | "XXXXX" |
| 2 | RIGHT(A8,4) | Adds the last four characters as they are. | "XXXXX5678" |
Read it left to right. MAX stops the count going below zero, so a short ID shows in full. The original cell doesn't change. The IDs here are made-up.
=REPT("X",MAX(0,LEN(A8)-4))&RIGHT(A8,4)How to use it
Yellow bar at the top? Click Enable Editing.
- See it work. The Example tab shows 20 made-up examples with the formula already in.
- Use your own IDs. Paste IDs, stored as text, into the green column of the Template tab. The masked IDs fill in by themselves.
- Move them into your letter. Copy the results. Then use Paste Special and choose Values.
Before you send
An ID of four characters or fewer stays fully visible. Check short IDs before you share the list.
Microsoft's help: REPT function
OTHER ROUTES YOU MIGHT LIKE

Write a masked EIN with its hyphen
012345678 → **-***5678
Get the template →
Write an NPI-ending caption
1234567890 → NPI ending 7890
Get the template →
Build a labeled NPI and TIN line
1234567890 + 012345678 → NPI: 1234567890 | TIN: 012345678
Get the template →
Merge a few test letters before the whole mailing
Whole mailing → records 2 to 4 only
Take this route →