Avoid adding a surname twice

Join a name and surname, without doubling a surname that's already at the end.

What you'll make

In Excel: Ava Reed + Reed becomes Ava Reed.

The formula

The formula, with a numbered bracket under each part.
NumberPartWhat it doesResult so far
1TRIM(A8)=TRIM(B8)True when the name is only the surname.FALSE
2RIGHT(TRIM(A8),LEN(TRIM(B8))+1)=" "&TRIM(B8)True when the name ends with a space and the surname.TRUE
3TRIM(A8)Column A alone, when it already ends with the surname."Ava Reed"
4TRIM(A8&" "&B8)Joins the name and surname with one space.Not used for row 8
5IF( … )Skips adding the surname when part 1 or 2 is true."Ava Reed"

Read it left to right. OR( … ) around parts 1 and 2 means either one is enough. Capitals don't matter, so reed matches Reed.

=IF(OR(TRIM(A8)=TRIM(B8),RIGHT(TRIM(A8),LEN(TRIM(B8))+1)=" "&TRIM(B8)),TRIM(A8),TRIM(A8&" "&B8))

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 column A of the Template tab and surnames into column B. Full names fill in by themselves.
  3. Move them into your letter. Copy the results. Then use Paste Special and choose Values.

Before you send

The surname must match the end of the name exactly, apart from capitals. Reed won't match Reed Jr. or Reid.

Route: Get names ready for the letter

Microsoft's help: RIGHT function