Delete text after second carriage return (line break)

davidbrugge

New Member
Joined
May 11, 2014
Messages
17
Hello,

I have a spreadsheet with text in cells B2:B500. The amount of text varys from cell to cell and most of the text(sentences) have carriage returns/line breaks between them. I am only interested in the text mentioned in the first two lines of the cell and I want everything after that deleted. So the example below shows all the text in cell B2 - I want a formula for cell C2 to keep the red text and delete the blue text.

Code:
[COLOR="#FF0000"]This is all the information I need
for my report.[/COLOR]

[COLOR="#0000FF"]All of this text after the second line break
should be ignored or deleted[/COLOR]

The only thing common in each cell between the first sentence and the remaining text is a line break, so I think this is the only reference I can use in the formula.

Any ideas?

Thanks,
David
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
Thanks for quick reply.

That works for some cells but if the cell does not have a line break then it returns "#value!". Sorry I should have been more clear in my first thread - most of the cells do have line breaks but there are some cells that don't.

Any other suggestions?
 
Upvote 0
Thanks for quick reply.

That works for some cells but if the cell does not have a line break then it returns "#value!". Sorry I should have been more clear in my first thread - most of the cells do have line breaks but there are some cells that don't.

Any other suggestions?

No prob... and yeah you just use iferror...

=iferror(mid(b2,1,search(char(10),b2)-1),b2)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,741
Members
449,050
Latest member
excelknuckles

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