Function Problems

How to Extract Surnames to Create Family Labels in Excel

John WilsonJohn Wilson Oct 26, 2026 869 views

Question details

The user needs to convert multiple names listed in a single cell (like "John Smith & Jane Smith") into a unified family label ("The Smith Family").

How to Extract Surnames and Create Family Labels in Excel
Product
Excel
Device & OS
not provided
Scenario
Formatting a mailing list or contact directory where multiple family members are grouped in one cell.
Observed behavior
The user is looking for an automated formula to extract the final surname from a string of names and wrap it with the words "The" and "Family".
Before you start

Verify that your name data uses a consistent format, with single spaces separating first and last names, and remove any accidental trailing spaces at the very end of the cell entries.

Solution 1Recommended

Use Text Functions to Isolate the Surname

Combine the RIGHT, SUBSTITUTE, REPT, and TRIM functions to dynamically extract the last word in a text string.

This formula works by replacing every single space in the cell with a massive block of spaces. It then extracts the rightmost characters, which guarantees capturing the last word along with some leading spaces. Finally, TRIM removes those extra spaces, leaving just the surname.

1
Select the target cell

Click on an empty cell next to your name data where you want the family label to appear (for example, B2).

2
Enter the primary formatting formula

To format every value in the column as a family name, type the following formula and press Enter: ="The "&TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)))&" Family"

3
Use conditional formatting for specific entries (Optional)

If you only want to apply this label to entries containing multiple names joined by an ampersand (&), use this conditional formula instead: =IF(ISNUMBER(FIND("&",A2)),"The "&TRIM(RIGHT(SUBSTITUTE(A2," ",REPT(" ",LEN(A2))),LEN(A2)))&" Family",A2)

4
Apply to the entire list

Double-click the small square fill handle in the bottom-right corner of the cell to copy the formula down your entire contact list.

Use Text Functions to Isolate the Surname
Data Consistency Check: Ensure your last names don't contain suffixes like 'Jr.' or 'III', as the formula specifically isolates the absolute last word in the text string.
Free Microsoft Office alternative

Easily Manage Contact Lists with WPS Spreadsheet

WPS Spreadsheet fully supports advanced text formulas, allowing you to instantly extract surnames and create customized mailing labels for your contact lists with zero hassle.

  1. 1. Open your file: Open your existing contact list document directly in WPS Spreadsheet.
  2. 2. Apply the formula: Paste the text extraction formula into a new column next to your names.
  3. 3. Fill down: Drag the fill handle downwards to instantly apply the family label format to thousands of rows.
100% compatible with Microsoft Excel formulas and .xlsx filesBuilt-in Flash Fill to recognize complex data patterns automaticallyLightweight, fast, and completely free to use for daily tasks
microsoft office alternative - wps office

Frequently Asked Questions

What happens if a name ends with a suffix like Jr. or Sr.?

Because the formula specifically extracts the last string of text after the final space, it will grab the suffix instead of the surname. You should clean your data by removing suffixes using the Find and Replace tool before applying the formula.

Why does the formula return a blank or an incorrect word?

This is typically caused by accidental, invisible spaces at the very end of your original text string. You can use the TRIM function on your original source data first to clean up any trailing spaces.

Can I use this text extraction formula in Apple Numbers?

Yes, Apple Numbers supports all the core functions used in this formula, including SUBSTITUTE, RIGHT, LEN, REPT, and TRIM. You can paste it directly into a Numbers cell, updating the cell references as needed.