Function Problems

How to Extract Last Name from Full Name Using Excel Formulas

Nimra MalikNimra Malik Nov 2, 2026 869 views

Question details

The user needs a reliable Excel formula to extract only the last name from a full name text string.

How to Extract Last Name from Full Name Using Excel Formulas
Product
Excel
Device & OS
not provided
Scenario
Extracting the final word from a cell containing complex names, including multiple words, initials, or ampersands.
Observed behavior
Basic formulas using FIND return everything after the first space (e.g., returning 'L. & Susan A. Brown' instead of just 'Brown'), failing to isolate the final word correctly.
Before you start

Ensure that your text data does not contain trailing spaces at the very end of the name, as this formula identifies the last actual space between words to extract the final word.

Solution 1Recommended

Use a Combination of TRIM, RIGHT, SUBSTITUTE, and REPT Formulas

This formula is the most reliable method for extracting the last word of a text string because it works backwards from the end of the text, avoiding issues with multiple middle spaces.

Because Excel evaluates text functions from left to right, standard FIND operations fail when encountering names with varying amounts of spaces. By replacing all spaces with a massive padding block, isolating the right side of the text, and trimming it, you reliably get the last string component.

1
Select the destination cell

Click on the cell where you want the extracted last name to be displayed (e.g., B37).

2
Enter the text manipulation formula

Type the formula =TRIM(RIGHT(SUBSTITUTE(A37," ",REPT(" ",LEN(A37))),LEN(A37))) into the formula bar. Replace A37 with the reference to your target cell.

3
Apply and drag

Press Enter. Select the filled cell and double-click the fill handle in the bottom-right corner to copy the formula down your column.

Use a Combination of TRIM, RIGHT, SUBSTITUTE, and REPT Formulas
How the formula works: SUBSTITUTE and REPT replace every single space with a block of spaces equal to the length of the string. The RIGHT function grabs the end block (which now only contains padding and the final word), and TRIM removes all the excess padding, leaving just the last name.
Text Extraction with WPS Spreadsheet

Effortlessly Manage Text Data in WPS Spreadsheet

WPS Spreadsheet provides robust, professional-grade data manipulation tools. Whether you need complex nested formulas like TRIM and SUBSTITUTE or intelligent data features like Flash Fill, WPS handles your text extraction seamlessly.

  1. 1. Open your dataset in WPS Spreadsheet: Launch WPS Office and open your spreadsheet document containing the list of full names.
  2. 2. Apply the extraction formula: Select a blank cell adjacent to the name and input the extraction formula: =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1))).
  3. 3. Fill the column: Press Enter to execute the formula, then grab the fill handle in the lower right corner of the cell and drag it downward to complete your list.
100% compatible with all Microsoft Excel formulas and formatting.Includes intuitive Flash Fill capabilities to extract names in seconds without formulas.Lightweight program offering smooth performance even with thousands of rows of text data.
microsoft office alternative - wps office

Frequently Asked Questions

Why does the FIND formula return everything after the first space?

The FIND and SEARCH functions in Excel evaluate text strings strictly from left to right. Once they hit the very first space, they stop searching. If you use a simple RIGHT and FIND combination, it calculates from that first space, causing it to return middle names, initials, and ampersands instead of isolating the final word.

Will this formula work if a name ends with a suffix like 'Jr.' or 'Sr.'?

Yes, but with a caveat. The formula strictly extracts whatever characters follow the absolute final space. If the name is 'John Smith Jr.', the formula will extract 'Jr.' instead of 'Smith'. For names with suffixes, you may need to use a cleaner dataset or more advanced nested IF statements.

How can I extract the first name instead of the last name?

Extracting the first name is much simpler because you only need to locate the first space. You can use the formula =LEFT(A1, FIND(" ", A1) - 1). This tells Excel to extract all text from the left until it hits the very first space character.