Get first part of hyphenated last name

Turn Reed-Park into Reed for short labels and greetings.

What you'll make

In Excel: Reed-Park becomes Reed.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1TEXTBEFORE(A8,"-")Takes what comes before the first hyphen."Reed"
2TRIM( … )Removes any spaces left at the ends."Reed"
3TRIM(A8)With no hyphen, keeps the whole last name.Not used for row 8
4IFERROR( … )Switches to part 3 when there is no hyphen."Reed"

Each bracket wraps the one above it, so Excel works from the inside out.

=IFERROR(TRIM(TEXTBEFORE(A8,"-")),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 last names into the green column of the Template tab. The first parts fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

Only the part before the first hyphen is kept, so Lopez-Santos-Dubois gives Lopez. Check names with two hyphens by hand.

Route: Get names ready for the letter

Microsoft's help: TEXTBEFORE function