How to Extract Surnames to Create Family Labels in Excel
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").

- 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".
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.
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.
Click on an empty cell next to your name data where you want the family label to appear (for example, B2).
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"
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)
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 Flash Fill for Simple Pattern Extraction
For shorter or consistently formatted lists, the Flash Fill feature can often recognize the pattern and extract the names without needing a complex formula.
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. Open your file: Open your existing contact list document directly in WPS Spreadsheet.
- 2. Apply the formula: Paste the text extraction formula into a new column next to your names.
- 3. Fill down: Drag the fill handle downwards to instantly apply the family label format to thousands of rows.

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.




