Trouble splitting text to columns

laundon

New Member
Joined
Jan 5, 2005
Messages
18
Office Version
  1. 365
  2. 2021
Platform
  1. Windows
I have some base data where Cell A2 contains a unique number, and cell B2 contains a block of text, separated by what looks like a carriage return or line feed.

I need to, in a perfect world, split the contents of B2 across the spreadsheet.

I've tried Text to Columns and using Ctrl-J as the delimiter, but I can't seem to get this to do anything at all.

If I look at the csv file in Notepad++ I see CR and LF after every sentence.

Any advice would be greatly appreciated as I'm pulling what little hair I have left out!

Many thanks,
Tim
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Have never tried TTC with line breaks, but they are usually recognized in one of three ways, depending on the use and environment:
vba: vbCrLf (carriage return and line feed)
vba: Chr(13) & Chr(10) - and must be in that order. Chr() is the character function
sheet cell - I believe the only character that you have to worry about is chr(10) if you used Ctl+Enter to split your lines

So use the TTC dialog, choose "other" as the delimiter, click in the character box and press ctrl+Enter and it should work. I only mentioned the other aspects in case anyone reading this can use the other info.
 
Upvote 0
Assume your data is in Column A and your range has been configured as Table 1

Here is a Power Query solution

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Split Column by Delimiter" = Table.SplitColumn(Table.TransformColumnTypes(Source, {{"Column1", type text}}, "en-US"), "Column1", Splitter.SplitTextByDelimiter("#(cr)#(lf)", QuoteStyle.Csv), {"Column1.1", "Column1.2"})
in
    #"Split Column by Delimiter"
 
Upvote 0
I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)

Need to find what the character(s) between the lines is/are. Try something like this with one of the multi-line cells. Pull the formulas shown down until you get all the characters listed down a column & their codes beside. We need to find out how many "blank" cells appear between each section in the left column and what the corresponding codes for those blank cells are in the right column.

24 01 22.xlsm
BC
2abc def ghi
3
4a97
5b98
6c99
7 10
8d100
9e101
10f102
11 10
12g103
13h104
14i105
Sample
Cell Formulas
RangeFormula
B4:B14B4=MID(B$2,ROWS(B$4:B4),1)
C4:C14C4=CODE(B4)
 
Upvote 1
I mistakenly wrote Ctrl+Enter; should have been Alt+Enter. Oddly enough, if you entered the data using Alt+Enter to split the lines but specify Ctrl+Enter as the character to split on, it works as I suggested (and should work for any version)?

BEFORE
1705875529220.png


PREVIEW
1705875555874.png
 
Upvote 0
Thanks for all your replies. Greatly appreciated.

I can't get any of the above to work on my data, however, a colleague has assisted and wrote a Python script for me so I'm all sorted.

Once again, many thanks, and @Peter_SSs, I've updated my account details :)
 
Upvote 0

Forum statistics

Threads
1,223,227
Messages
6,170,853
Members
452,361
Latest member
d3ad3y3

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