Thread: [Solved] Text in string
View Single Post
 
Old 11-23-2014, 12:03 AM
Catalin.B Catalin.B is offline Windows Vista Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Hi,
Here is another option, using a formula:
=TRIM(MID(SUBSTITUTE($A1,"/",REPT(" ",999)),(4-1)*999+1,999))
This will extract the 4'th item . If you want an item from another position, you can change the number 4 highighted in red to the position desired.
You can even use the column parameter to automatically extract all elements from the text string:
=TRIM(MID(SUBSTITUTE($A1,"/",REPT(" ",999)),(COLUMN(A1)-1)*999+1,999))
If you copy this to the right, it will be the equivalent of the text to columns functionality.
I wrote a text to columns formula using another approach, but more complicated, at: http://www.myonlinetraininghub.com/t...-excel-formula
But it's mostly an exercise for creating complex formulas, it's not very simple.
In the attachment, you can find the file from the link provided, it also has a VBA version of splitting a text, similar to Bruno's solution.
Attached Files
File Type: xlsm Text to Columns with formula and VBA.xlsm (179.0 KB, 10 views)
Reply With Quote