A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi,
In cell B2, enter this formula
=textafter(A2," ",-1)
Hope this helps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
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
A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Answer accepted by question author
Hi,
In cell B2, enter this formula
=textafter(A2," ",-1)
Hope this helps.
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:
In simple terms, this formula works by:
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.