Tuesday 20 May 2014

Delete ALT+ENTER / Line Breaks in Excel

How to insert next line in a cell in excel, Insert line break in excel, Remove ALT+ENTER Special character, Delete ALT+ENTERed symbol, Remove line break, Easiest way to delete ALT+ENTER / line breaks or Special Character (CHAR(10).

Sometimes you need to insert a next line in a cell in Excel, but when you press Enter, it moves into  the next cell so what should we do to insert a line break / new line in a cell in MS Excel. To insert a new line / line break you will have to press ALT+ENTER whenever you want to enter a new line or line break in a cell in MS Excel.
Now here is a very important question, if we want to remove or delete this line break / new line and want to have text in a single line, what we can do?
When we press ALT+ENTER a new special character is inserted at that place, to remove that special character we can use methods.

So, if you want to get rid of the line break or remove the special character which occured when you press ALT+ENTER you can simply click immediately before the line break and press Delete button or click immediately after the line break and press Backspace button.

But if you have a worksheet that has a lot of cells that contains line breaks or lets say this special character and you need to delete (get rid of line breaks)  that special character or line break from the cells in MS Excel, you will not use Delete button or Backspace button because it's not a right exercise or a time consuming exercise. Is macro required for this exercise, No!

Here are some methods to delete / remove line break / ALT+ENTER special character:-

1:- Using Find & Replace:
By using Find & Replace method you can quickly get rid of all those line breaks in your worksheet. If you want to remove or delete line breaks or ALT+ENTERed special character from only part of the worksheet, select that range first, otherwise select any single cell. Then

I) Press CTRL+H (Keyboard shortcut for FIND & SELECT And REPLACE), You can open FIND & REPLACE dialog box by going to Home tab and select REPLACE from the drop down option of FIND & SELECT which is in EDITING group.

 
II) Click in the 'Find What' field, hold down the ALT key and type 0010 (only using the numeric keypad) and release the ALT key. It may looks like nothing in the 'Find What' field but you have actually entered an invisible (line break) character.

NOTE:- You can use CTRL+J instead of ALT+0010 in 'Find What' field. This shortcut is easier to remember or use.

III) Click in the 'Replace with' field, press the spacebar once or any character or word you want to replace ALT+ENTER with and click the Replace All button.

2:- Remove, replace or delete manual new line / line breaks in Excel cells by using Wrap Text.

Remember that Excel automatically applies Wrap Text to cells when a forced line break is inserted, so to remove the wrapped text formatting go to the the Home tab and click Wrap Text in Alignment group.

It may not be apparent but you may have caused some cells to have two blank spaces. You can easily find and Delete, Remove, Replace or get rid of them by using Find & Replace, just enter the two blank spaces in the 'Find What' field and replace it with one blank space in 'Replace with' field.

3:- Remove, Delete ALT+ENTER (get rid of line breaks) Using a Formula:
You can also use a formula to remove / delete line breaks (ALT+ENTER character).
Here is a very interesting formula given below:  
 
I) =SUBSTITUTE(A1,CHAR(10)," ")
Use this formula to replace manual line breaks in Excel cells.
How it does work?(How to use substitute function in Excel or how substite work in Excel)?


Actually Substitute function replace an old character or word with a new word or charcter you want.
=SUBSTITUTE(text, old text, new_text, [nth_appearence or instance number])
Here:

A1 =  text (in which you want to replace, remove or delete ALT+ENTER / line break)
 

CHAR(10) = special character code for ALT+ENTER
 

 " " =  New text "Space" (Replace ALT+ENTER / line break with space)
 

nth_Appearence  or instance number = used when you want to replace or remove the Nth number of Character or Word(Lets say if you have two ALT+ENTER or two line breaks in a cell and you want to remove, replace or delete only first or second ALT+ENTER /  line break then just give Nth_appearence (Instance Number) 1 if you want to replace first ALT+ENTER /  line break or give Nth_appearence (Instance Number) 2 if you want to replace second ALT+ENTER /  line break).

NOTE:- You can also use =SUBSTITUTE(A1,"  "," ") to replace double blank spaces with single blank spaces, use two spaces inside double quotes instead of CHR(10) in the previous formula in place of FIND & REPLACE method.

II) Use Clean function to remove / Delete ALT+ENTER / line breaks in EXCEL:

Using CLEAN function is also one of the easiest way to remove, replace or delete ALT+ENTER character / symbol or line break in Excel Cells.
=CLEAN(A1)
Remember by using CLEAN function you can't add another character, string, symbol or word in place of ALT+ENTER /  line breaks.


1 comment: