Find line break in cell, insert in cell below

Jadatutor

New Member
Joined
Feb 8, 2023
Messages
3
Office Version
  1. 2019
Platform
  1. MacOS
Hi guys, sorry beginner thanks for any help in advance
I have a column where some cells contain linebreaks. I need the data on the new line to be placed in the next row.

This is how it is currently

Rabbit​
Dog
Cat
Monkey​
Horse​


and this is how I require it, each one on a new line
Rabbit​
Dog​
Cat​
Monkey​
Horse​

I would prefer to do it with a formula because my vba/macro skills are next to none.
Currently what I'm doing is text to the column, then inserting a space, and then pasting the results transposed.
its taking forever

cheers
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
A good alternative would be to use PowerQuery and split data to new rows. If formula is a must and data is not too big, maybe try:

Book1
A
1Rabbit
2Dog Cat Monkey
3Horse
4
5Rabbit
6Dog
7Cat
8Monkey
9Horse
Sheet10
Cell Formulas
RangeFormula
A5:A9A5=INDEX(FILTERXML("<t><s>"&SUBSTITUTE(TEXTJOIN(CHAR(10),,A$1:A$3),CHAR(10),"</s><s>")&"</s></t>","//s"),ROW(1:1))
 
Upvote 0
don't have powerquery. Also fyi got a mac. thank you for trying
 
Upvote 0
Book1
A
1Rabbit
2Dog Cat Monkey
3Horse
4
5Rabbit
6Dog
7Cat
8Monkey
9Horse
Sheet10
Cell Formulas
RangeFormula
A5:A9A5=TRIM(MID(SUBSTITUTE(TEXTJOIN(CHAR(10),,A$1:A$3),CHAR(10),REPT(" ",LEN(TEXTJOIN(" ",,A$1:A$3)))),1+(ROW(1:1)-1)*LEN(TEXTJOIN(" ",,A$1:A$3)),LEN(TEXTJOIN(" ",,A$1:A$3))))
 
Upvote 0
thank you but this isn't really doing it for me. i have over 65000 lines of data and what you provided is limited to 3 lines. Im so sorry for asking again but sometimes theres 20-30 linebreaks in 1 cell, what i need is a way to find any cell with multiple linebreaks and place every linebreak into the cell below the current cell. thanks in advance
 
Upvote 0
Are all values in the input unique?
 
Upvote 0

Forum statistics

Threads
1,215,013
Messages
6,122,694
Members
449,092
Latest member
snoom82

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