How to Remove Line Breaks in Excel: 5 Ways

Method 1 – Using the Find & Replace Tool to Remove Line Breaks in Excel

Steps

  • Select the range of cells C5:C9 where you want to remove the line breaks.

Remove Line Breaks Using ‘Find & Replace’ Command in Excel

  • Go to the Home tab in the ribbon and select Find & Select from the Editing group.

  • Select Replace from the Find & Select option.

Remove Line Breaks Using ‘Find & Replace’ Command in Excel

  • A Find and Replace dialog box will appear. Press Ctrl + J in Find What. It will put a line break character in that box.
  • Leave the Replace with box blank and click on Replace All.

  • This will remove line breaks from your dataset.

Remove Line Breaks Using ‘Find & Replace’ Command in Excel

Keyboard Shortcut

You can open the Find & Replace dialog box by pressing Ctrl + H on your keyboard.


Method 2 – Inserting the Excel CLEAN Function to Remove Line Breaks

Steps

  • Select cell D5 where you want to apply the CLEAN function.

  • Use the following formula
=CLEAN(C5)

CLEAN Function to Remove Line Breaks in Excel

  • Press Enter to apply the formula.

  • Drag the Fill Handle icon or double-click on the icon to apply this formula down column D.

CLEAN Function to Remove Line Breaks in Excel


Method 3 – Applying the TRIM Function to Erase Line Breaks

Steps

  • Select cell D5 where want to apply the TRIM function.

  • Use the following formula
=TRIM(C5)

Applying TRIM Function to Remove Line Breaks in Excel

  • Press Enter to apply the formula.

  • Drag the Fill Handle icon down the column or double-click on the icon to apply the formula.

Applying TRIM Function to Remove Line Breaks in Excel


Method 4 – Deleting Line Breaks by Applying the SUBSTITUTE Function

  • Select cell D5 to apply the SUBSTITUTE function.

  • Insert the following formula in the formula box.
=SUBSTITUTE(C5,CHAR(10),"")

CHAR(10) is the line break character. The SUBSTITUTE function will find all the line breaks and replace them with blanks.

Remove Line Breaks Utilizing SUBSTITUTE Function

  • Press Enter to apply the formula.

  • Drag the Fill Handle icon down the column or double-click on it to apply the formula.

Remove Line Breaks Utilizing SUBSTITUTE Function


Method 5 – Applying VBA Macro to Remove Line Breaks in Excel

Steps

  • Open the VBA window by pressing Alt+F11.

  • Go to the Insert tab and click on Module.

Embedding VBA Code to Remove Line Breaks

  • A Module code window will appear. Copy the following code and paste it into the module.
Sub RemoveLineBreaks_Excel()
For Each Cell In Selection
 Cell.Value = Replace(Cell.Value, Chr(10), "")
Next
End Sub
  • Save and close the code window.
  • Select the range of cells C5:C9.

  • Go to the View tab in the ribbon and select Macros.

  • Select RemoveLineBreaks_Excel from the Macro Name and click on Run.

Embedding VBA Code to Remove Line Breaks

  • Here’s the result.

Embedding VBA Code


Download the Practice Workbook


Related Articles


<< Go Back to Line Break in Excel | Text Formatting | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Durjoy Paul
Durjoy Paul

Durjoy Kumar, with a BSc in Naval Architecture & Engineering from Bangladesh University of Engineering and Technology, is a dedicated contributor to the ExcelDemy project. His substantial contributions include crafting numerous articles and demonstrating expertise in Excel and VBA. Durjoy adeptly automates Excel challenges using VBA macros, offering valuable solutions for user interface challenges. Apart from creating Excel tutorials, he is interested in Data Analysis with MS Excel, SPSS, C, C++, C#, JavaScript, Python Web Scraping, Data Entry... Read Full Bio

2 Comments
  1. Hi,
    ive a excel sheet with a column containing multiple line breaks but if i use the “ctrl+J” to remove them they cant just be removed yet the sheet is unlocked. Can you please help on this?

    • Hi Mikekelly
      Thanks for your query.
      The ‘Ctrl+J’ command doesn’t replace the line break. It represents the line break feature when we use the Find & Replace dialog box to find this character. Now, If you look at our dataset, it was designed with multiple line breaks in a column. So, I hope that both datasets follow the same characteristic. To eliminate the line breaks from your sheet, you can go through the methods mentioned in this article. Among them, methods no 2, 3, and 4 are pretty simple and convenient. Moreover, in these methods, you do not have to deal with the ‘Ctrl+J’ command.
      Let us know whether you can solve the issue. Please feel free to share with us if you have any further queries.

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo