Extract Middle Words from a Text String with Multiple Dots

justmecat

New Member
Joined
Oct 22, 2012
Messages
2
Hi there,

I've been searching for an optimal excel formula that could help me to solve the following problem, but I've been unable to find a right solution yet; so I hope you guys can help me!

The example would be:

black.blue.red.yellow.green.white

I'd like to extract just "blue.red.yellow.green" to the following spreadsheet column, keeping the intermediate dots, but getting rid of the first/last words and their succeeding or preceding dots.

I've tried using RIGHT, LEFT, MID formulas unsuccessfully, so I'd really appreciate if you guys can shed some light.

Thank you!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Welcome to MrExcel.

How about?

=MID(A1,FIND(".",A1)+1,FIND(CHAR(1),SUBSTITUTE(A1,".",CHAR(1),LEN(A1)-LEN(SUBSTITUTE(A1,".",""))))-(FIND(".",A1)+1))
 
Upvote 0
Rather long....but should work.

=MID(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),""),1,LEN(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),""))-LEN(MID(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),""),MATCH(2,1/--(MID(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),""),ROW(INDIRECT("1:"&LEN(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),"")))),1)=".")),LEN(SUBSTITUTE(B21,MID(B21,1,SEARCH(".",B21,1)),"")))))
 
Upvote 0
This is very helpful and I'm sorry, but I'm having a hard time understanding the individual components. I have a similar scenario as follows:

John Smith ...................................Marketing Manager .................................................................................................................ABC Co
Jim Jones.......................................Senior Vice President .................................................................................HIJ Inc
Julie Johnson .....................................HR Manager............................................................................................................................. XYZ LLC

<colgroup><col></colgroup><tbody>
</tbody>

With variable lengths of ellipses, how do I grab the middle part (job title) and the right part (the company name)?

Appreciate your help!
 
Upvote 0
Welcome to MrExcel.

This example uses helper columns. They are not strictly necessary but the formula would become very long without them.


Excel 2010
ABCDE
1John Smith ........................Marketing Manager .............................................ABC CoJohn|Smith| Marketing|Manager| ABC|CoMarketing|Manager| ABC|CoMarketing ManagerABC Co
2Jim Jones.......................................Senior Vice President ...............HIJ IncJim|Jones Senior|Vice|President| HIJ|IncSenior|Vice|President| HIJ|IncSenior Vice PresidentHIJ Inc
3Julie Johnson ......HR Manager................................................................. XYZ LLCJulie|Johnson| HR|Manager |XYZ|LLCHR|Manager |XYZ|LLCHR ManagerXYZ LLC
Sheet3
Cell Formulas
RangeFormula
B1=TRIM(SUBSTITUTE(SUBSTITUTE(A1," ","|"),"."," "))
C1=TRIM(MID(B1,FIND(" ",B1),255))
D1=TRIM(SUBSTITUTE(LEFT(C1,FIND(" ",C1)-1),"|"," "))
E1=TRIM(SUBSTITUTE(RIGHT(C1,LEN(C1)-FIND(" ",C1)),"|"," "))
 
Upvote 0
Hi,

I think I have quite a similar problem as the original poster of this thread.

I have for example the following two strings, each in a cell:

I100367/text= "NEW OVARY" /MainGroup= 0/data= ""/display= ""/rep_int= ""/rep_ext= ""/prec= I100366/menu= M2415919103/with_comment= 0/with_site= 0/with_count= 0/default= 0/def_comment= ""/def_count= 1/calc= ""/exclusive= 0;
I100095/text= cervix /MainGroup= 0/data= ""/display= ""/rep_int= ""/rep_ext= ""/prec= I100093/menu= M2415919103/with_comment= 0/with_site= 0/with_count= 0/default= 0/def_comment= ""/def_count= 1/calc= ""/exclusive= 0;

And I would like to extract from the 1st cell "NEW OVARY" and for the 2nd cell "cervix"

That is, I want to extract out of the string everything after "/text= " (this is a constant) and before " /MainGroup=" (this is also a constant)

I've tried with FIND, MID, RIGHT, LEFT and I can successfully extract a certain amount of characters after the first constant but I don't know how to implement the 2nd constant into the formula.

Thank you if anyone has any suggestions!
 
Upvote 0

Forum statistics

Threads
1,215,475
Messages
6,125,028
Members
449,205
Latest member
Eggy66

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