Formula to remove first and last word

DHayes

Board Regular
Joined
Nov 12, 2014
Messages
244
Good Day,
I have searched and I can't find a formula to remove the first word and last word in excel.

What I have
Physician Ranchod Rakesh Naidoo (Rakesh)

Result I would like to achieve.
Ranchod Rakesh Naidoo
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi there.

I cobbled this formula together from 2 others:

=LEFT(MID(A1,FIND(" ",A1)+1,256),FIND("^^",SUBSTITUTE(MID(A1,FIND(" ",A1)+1,256)," ","^^",LEN(MID(A1,FIND(" ",A1)+1,256))-LEN(SUBSTITUTE(MID(A1,FIND(" ",A1)+1,256)," ",""))))-1)

where A1 is the source data.

Regards
John
 
Upvote 0
Hi,

If the Last word may or may Not be contained in Brackets, use B1 formula.
If the Last word is Always contained in Brackets, use C1 formula.


Book1
ABC
1Physician Ranchod Rakesh Naidoo (Rakesh)Ranchod Rakesh NaidooRanchod Rakesh Naidoo
2Physician Dr. Ranchod Rakesh Naidoo (Rakesh)Dr. Ranchod Rakesh NaidooDr. Ranchod Rakesh Naidoo
3Physician Dr. Ranchod Rakesh Naidoo RakeshDr. Ranchod Rakesh Naidoo
Sheet546
Cell Formulas
RangeFormula
B1=TRIM(LEFT(SUBSTITUTE(MID(A1,FIND(" ",A1),255)," ",REPT(" ",255),LEN(A1)-LEN(SUBSTITUTE(A1," ",""))),255))
C1=MID(A1,FIND(" ",A1)+1,FIND("(",A1)-FIND(" ",A1)-2)
 
Upvote 0
or PowerQuery

Code:
[SIZE=1]let
    Source = Excel.CurrentWorkbook(){[Name="Table2"]}[Content],
    Extract = Table.TransformColumns(Table.TransformColumns(Source, {{"Column1", each Text.AfterDelimiter(_, " "), type text}}), {{"Column1", each Text.BeforeDelimiter(_, " ", {0, RelativePosition.FromEnd}), type text}})
in
    Extract[/SIZE]

[Table="width:, class:head"]
[tr=bgcolor:#FFFFFF][td=bgcolor:#5B9BD5]Column1[/td][td][/td][td=bgcolor:#70AD47]Column1[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Physician Ranchod Rakesh Naidoo (Rakesh)[/td][td][/td][td=bgcolor:#E2EFDA]Ranchod Rakesh Naidoo[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Physician Dr. Ranchod Rakesh Naidoo (Rakesh)[/td][td][/td][td]Dr. Ranchod Rakesh Naidoo[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]Physician Dr. Ranchod Rakesh Naidoo Rakesh[/td][td][/td][td=bgcolor:#E2EFDA]Dr. Ranchod Rakesh Naidoo[/td][/tr]

[tr=bgcolor:#FFFFFF][td]Dr Mike Willis Sutton III (blablabla)[/td][td][/td][td]Mike Willis Sutton III[/td][/tr]

[tr=bgcolor:#FFFFFF][td=bgcolor:#DDEBF7]ABC Wilma Buffon 123[/td][td][/td][td=bgcolor:#E2EFDA]Wilma Buffon[/td][/tr]
[/table]
 
Upvote 0
Here is another formula that should work whether the last word is in parentheses or not...

=TRIM(MID(SUBSTITUTE(A1," ",REPT(" ",100)),100,300))
 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,912
Members
452,366
Latest member
TePunaBloke

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