Extract 2nd to last word

chrono2483

Board Regular
Joined
Aug 23, 2014
Messages
164
Office Version
  1. 2016
Hello,

I found an old thread from 2008 that helped with extracting the 2nd last word from a string of text. However, when I apply it to my situation, it adds the comma that is attached to the word. Is there any way of getting this work without the comma?

formula used: =TRIM(LEFT(RIGHT(" "&SUBSTITUTE(TRIM(A1)," ",REPT(" ",60)),120),60))

The string of text can vary.

Thank you.
 
Last edited:
Yes, there would always be a comma and a space after the work in question: Ex. Simpson, Homer .... Doe, John .... Smith, Paul
Hmm! Last name followed by first name... what is located between any two names (where I have the red question mark below), a space, a comma/space, something else?

LastName1, FirstName1?LastName2, FirstName2?LastName3, FirstName3

Also, from the above example, what do you want returned as the second to last "word"...

LastName3

or

LastName2, FirstName2
 
Upvote 0

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Hmm! Last name followed by first name... what is located between any two names (where I have the red question mark below), a space, a comma/space, something else?

LastName1, FirstName1?LastName2, FirstName2?LastName3, FirstName3

Also, from the above example, what do you want returned as the second to last "word"...

LastName3

or

LastName2, FirstName2

Here is a visual of how the data currently looks:
Simpson, Homer
Doe, John
Doe, Jane
Jackson, Paul
Belle, Rogue

<tbody>
</tbody>

The data is in a single column, with the rows dynamic, depending on how many names are pulled that particular day. What I want to be able to do is return only the last name in a separate column.

Ex:

Simpson, Homer
Simpson
Doe, John
Doe
Doe, Jane
Doe
Jackson, Paul
Jackson
Belle, Rogue
Belle

<tbody>
</tbody>
 
Upvote 0
Here is a visual of how the data currently looks:
Simpson, Homer
Doe, John
Doe, Jane
Jackson, Paul
Belle, Rogue

<tbody>
</tbody>

The data is in a single column, with the rows dynamic, depending on how many names are pulled that particular day. What I want to be able to do is return only the last name in a separate column.

Ex:

Simpson, Homer
Simpson
Doe, John
Doe
Doe, Jane
Doe
Jackson, Paul
Jackson
Belle, Rogue
Belle

<tbody>
</tbody>
Your original question asked for the second to last word which made it sound like you had several names in your cell (that is, more than 2 of them) and that you wanted the next to last name; but actually, your cells contain a single name and you want the first name from it...

=LEFT(A1,FIND(",",A1&",")-1)
 
Upvote 0

Forum statistics

Threads
1,216,102
Messages
6,128,851
Members
449,471
Latest member
lachbee

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top