Extracting text from cell into different columns without using "Text to Columns" function

striker359

Board Regular
Joined
Jun 19, 2014
Messages
64
Hi, I would like to extract the text from a cell into different columns.

Eg. In cell I32, I have

SLVT920H SLVT921H SLVT923H SLVT935H SLVT978A SLVT910H SLVT911H SLVT979H SLVT982H

I would like to extract the text and put them into different columns.


End Result:

SLVT920H | SLVT921H | SLVT923H | SLVT978A | etc.

How should I go about doing it?
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
If the length of each string is same which in this case is 8, then something like this will work, you can drag the formula in B1 across the cells


Excel 2010
ABCDEFGHIJ
1SLVT920H SLVT921H SLVT923H SLVT935H SLVT978A SLVT910H SLVT911H SLVT979H SLVT982HSLVT920HSLVT921HSLVT923HSLVT935HSLVT978ASLVT910HSLVT911HSLVT979HSLVT982H
Sheet5
Cell Formulas
RangeFormula
B1=MID($A$1,9*(COLUMN(A$1)-1)+1,8)


If the lengths are not fixed, the formula becomes more complex,

WHY DON'T YOU WANT TO USE TEXT TO COLUMNS?
 
Upvote 0
you could use the mid function.
=MID(A1,1,8), then in the next column =MID(A1,10,8) and the enxt column =MID(A1,19,8)

You could put the Lengths, and start values in the header.

If you don't want to use text to column, then that is an option. :)
 
Upvote 0
@Momentman: Coz i want to take this opportunity to learn about doing it functionally and it kind of helps to automate the process as well.. so all I need to do is have the information and the text are extracted automatically.

@dermie_72: That works when they are of equal length.. any idea what I should do if they happen to be of different character lengths?
 
Upvote 0
I have uploaded some sample data and the result the formula gives

The formula in B1 can be dragged across the columnsto give you the results and also dragged down the rows for as many entries as you have


Excel 2010
ABCDEFGHIJ
1SLVT920H SLVT921H SLVT923H SLVT935H SLVT978A SLVT910H SLVT911H SLVT979H SLVT982HSLVT920HSLVT921HSLVT923HSLVT935HSLVT978ASLVT910HSLVT911HSLVT979HSLVT982H
2The boy is a great playerTheboyisagreatplayer
3Ask and it shall be given unto youAskanditshallbegivenuntoyou
4MrExcel is a wonderful forumMrExcelisawonderfulforum
Sheet5
Cell Formulas
RangeFormula
B1=IFERROR(MID(" "&$A1&" ",FIND("*|",SUBSTITUTE(" "&$A1&" "," ","*|",COLUMN(A$1)))+1,FIND(" "," "&$A1&" ",FIND("*|",SUBSTITUTE(" "&$A1&" "," ","*|",COLUMN(A$1)))+1)-FIND("*|",SUBSTITUTE(" "&$A1&" "," ","*|",COLUMN(A$1)))-1),"")
 
Upvote 0
You can also do it with the sligthly shorter:

=IFERROR(TRIM(MID(SUBSTITUTE($A1," ",REPT(" ",113)),113*(COLUMNS($A:A)-1)+1,113)),"")


Again, copy to the right as required.

Regards
 
Upvote 0
@Momentman: Your code gave me a blank cell.. no idea if it's coz i'm using Excel 2007 or not.. anyway may I just ask, what does "*|" actually mean? Thanks for accomodating my requests thus far.

@XOR LX: The code worked. Mind me asking what does REPT actually do?
 
Upvote 0
@Momentman: Your code gave me a blank cell.. no idea if it's coz i'm using Excel 2007 or not.. anyway may I just ask, what does "*|" actually mean? Thanks for accomodating my requests thus far.

@XOR LX: The code worked. Mind me asking what does REPT actually do?

You're welcome.

REPT repeats a character a specified number of times. It's used here to extend the single spaces between the words to larger ones (of length 113, in my case), which is fundamental to the working of this solution.

Regards
 
Upvote 0
@XOR LX: Came into another snag... unfortunately some of the data cells had strikethroughs but the code returns the value without the strikethroughs... this I'm not surprised.. but is there by any chance, possible for the codes to return cell formatting as well??
 
Upvote 0
@XOR LX: Came into another snag... unfortunately some of the data cells had strikethroughs but the code returns the value without the strikethroughs... this I'm not surprised.. but is there by any chance, possible for the codes to return cell formatting as well??

No. Not without VBA.

Regards
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,803
Members
449,048
Latest member
greyangel23

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