How to extract words before and after a comma

Today, I encountered a situation where I had to separate the full names of our customers into the first and last names. The names are comma separated, so I was looking for an Excel formula that can help me extract the last name before the comma and the first name after the comma.

For example, you have the following text in a cell “A1″ and you’d like to extract the text before the comma (the last name):

“Doe, John”

To extract the last name before the comma “Doe” from A1, use one of the following formula:

=LEFT(A1,(FIND(",",A1,1)-1))

The result: Doe

To extract the first name after the comma from A1, use one of the following formula:

=MID(A1,FIND(",",A1)+2,256)

The result: John

Not working for you?

Remember to replace A1 with the cell that contains the string of words you want to parse out.

This entry was posted in Extracting words. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. Ct2k 12830
    Posted December 19, 2012 at 7:11 pm | Permalink

    thank you for this quick tip – it worked great

  2. karen
    Posted January 10, 2013 at 6:27 pm | Permalink

    You’re welcome! Glad I was able to help you save time :)

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>