Remove spaces around apostrophes

Turn Zoë O' Neill into Zoë O'Neill so names look right on letters and labels.

What you'll make

In Excel: O' Neill becomes O'Neill.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1A8The name. ' is a straight apostrophe."Ava Reed"
2TRIM( … )Removes extra spaces at the ends and in between."Ava Reed"
3SUBSTITUTE( … " '" … )Removes a space right before an apostrophe."Ava Reed"
4SUBSTITUTE( … "' " … )Removes a space right after an apostrophe."Ava Reed"

Each bracket wraps the one above it, so Excel works from the inside out. Names with no apostrophe stay the same.

=SUBSTITUTE(SUBSTITUTE(TRIM(A8)," '","'"),"' ","'")

How to use it

Yellow bar at the top? Click Enable Editing.

  1. See it work. The Example tab shows 20 made-up names with the formula already in.
  2. Use your own names. Paste names into the green column of the Template tab. Fixed names fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Only straight apostrophes are fixed. Change curly ones (’) to straight first, with lesson 051's formula.

Route: Get names ready for the letter

Microsoft's help: SUBSTITUTE function