Extract second to last word in a cell

Mychaltb

New Member
Joined
Nov 15, 2016
Messages
16
All,

Anyone know how to extract the second to last word of a cell using a formula? I am trying to find a way to extract the country name (second to last word of each cell) or have a formula lookup the country in the cell and return a number value based on lookup table. I have not been able to find my answer online so if anyone here can help it would be greatly appreciated!

FYI, I have about 2,000 lines ranging from 20 different countries. The second to last word is the name of the country in all cells. I know I could just do text to columns but not all the cells have the same amount of words so I would rather have a formula spit out what I need.

Example:

Starting in cell A1: Beer Pale Ale England Bottle
Return country name in cell b1: England

Thanks!
Mychal
 
Hi,

try this:
=LEFT(MID(A1,FIND("##",SUBSTITUTE(A1," ","##";LEN(A1)-LEN(SUBSTITUTE(A1," ",))-1))+1,999),FIND(" ",MID(A1,FIND("##",SUBSTITUTE(A1," ","##",LEN(A1)-LEN(SUBSTITUTE(A1," ",))-1))+1,999))-1)
 
Upvote 0
Try where A1 has the text string
Code:
=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",999)),1998),999))
 
Upvote 0
try

=TRIM(LEFT(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),200),100))
 
Upvote 0
=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",LEN(A1))), (IF(LEN(TRIM(A1))=0,0,LEN(TRIM(A1))-LEN(SUBSTITUTE(A1," ",""))+1)-2)*LEN(A1)+1, LEN(A1)))

Kind regards,

Chris
 
Upvote 0

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