Remove a fixed-length code after a name
Turn Ava Reed0042 into Ava Reed by removing the last 4 characters.
What you'll make

The formula

| Number | Part | What it does | Result so far |
|---|---|---|---|
| 1 | LEN(A8)-B8 | Counts the characters, minus the code's 4. | 8 |
| 2 | MAX(0, … ) | Never lets that number drop below 0. | 8 |
| 3 | LEFT(A8, … ) | Keeps that many characters from the start. | "Ava Reed" |
| 4 | TRIM( … ) | Removes any spaces left at the ends. | "Ava Reed" |
Each bracket wraps the one above it, so Excel works from the inside out.
=TRIM(LEFT(A8,MAX(0,LEN(A8)-B8)))How to use it
Yellow bar at the top? Click Enable Editing.
- See it work. The Example tab shows 20 made-up names with the formula already in.
- Use your own names. On the Template tab, paste the coded names into column A. Put how many code characters to remove into column B. The names fill in by themselves.
- Move them into your letter. Copy the results. Then use Paste Special and choose Values.
Before you send
Count the code's characters exactly. One too few leaves a digit at the end; one too many cuts off a letter.
Route: Get names ready for the letter
Microsoft's help: LEFT function
OTHER ROUTES YOU MIGHT LIKE

Keep a name before the last separator
Ava-Reed-0042 + separator - → Ava-Reed
Get the template →
Keep a name after the last separator
NE|Active|Ava Reed + | → Ava Reed
Get the template →
Flip surname-first fields at a separator
de la Cruz|Mary Ann + | → Mary Ann de la Cruz
Get the template →
Fix "Dear ," when a first name is blank
(blank) → Dear colleague,
Take this route →