Share via

How can I pull only last names from a list containing two and three word names

Oren Lifshitz 40 Reputation points
2025-07-17T14:33:36.6833333+00:00

I am working with a list of names in Excel. Some have only a first and last name, while others have a middle name as well. how can I pull out only the last names?

Thank you

Microsoft 365 and Office | Excel | For business | Windows
0 comments No comments

Answer accepted by question author

Ashish Mathur 85 Reputation points
2025-07-17T23:05:22.0966667+00:00

Hi,

In cell B2, enter this formula

=textafter(A2," ",-1)

Hope this helps.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Demi-N 17,740 Reputation points Microsoft External Staff Moderator
    2025-07-17T14:48:20.04+00:00

    Hello Oren Lifshitz,

    Thanks for reaching out with your Excel question about extracting last names.

    You can use the following formula to pull out the last word from each name, which typically corresponds to the last name:

    Let's assume your list of names is in Column A, starting from cell A1.

    You can put this formula in cell B1 (or any other empty cell next to your list):

    =TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))),LEN(A1)))
    
    

    How to Use It:

    1. Copy the formula above.
    2. Paste it into cell B1 in your Excel sheet.
    3. Press Enter. You should see the last name from cell A1 appear in B1.
    4. Drag the fill handle (the small square at the bottom-right corner of cell B1) down to apply the formula to the rest of your names in Column A.

     

    In simple terms, this formula works by:

    • Finding the very last space in the name.
    • Grabbing everything after that last space (which is your last name).
    • And then tidying it up by removing any extra spaces.

    It's designed to work whether a name has two words (e.g., "John Doe") or three words (e.g., "Jane Alice Smith").

     

    Example:

    If your names are in Column A:

    Column A (Name) Column B (Last Name)
    John Doe Doe
    John Doe Doe
    Jane Alice Smith Smith
    Robert Robert
    Mary Lee Johnson Johnson

    I hope this helps you pull out those last names! Please let me know if you have any trouble or if anything is unclear.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment”.  

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.