A carriage return is also known as a line break in an Excel cell. While they are technically different, the traditional meaning of carriage return from typewriters is rarely used in modern operating systems.
In the following image, we have used the CHAR(10) with other functions to add carriage returns. For example, in Cell E5, we used the ampersand (&) operator to join cells B5, C5, and D5. We also applied the CHAR(10) function to add carriage returns after cells B5 and C5.
⏷What is Carriage Return?
⏷Insert Carriage Return in Excel
⏵Use Keyboard Shortcuts
⏵Merge CHAR, CONCATENATE & TEXTJOIN Functions
⏵Use Find and Replace Feature
⏵Apply VBA Code
⏷Remove Carriage Return
⏵Use Find and Replace Feature
⏵Merge TRIM and SUBSTITUTE Functions
⏵Use VBA Code
⏷Tips for Carriage Return in Excel
⏷Things to Remember
⏷Frequently Asked Questions
⏷Carriage Return in Excel: Knowledge Hub
What Is a Carriage Return?
Carriage return adds a line break within a single cell instead of using multiple cells. It is also known as the return or line feed character. ASCII code 10 represents the character for Windows.
The Wrap Text feature offers similar functionality, however it doesn’t always allow the line to break in the desired position. Adding a carriage return puts the line break where we want it to be.
How to Insert a Carriage Return in Excel
Method 1 – Using Keyboard Shortcuts
- Select the cell and press the F2 key to enter edit mode.
- Place the cursor where you want to add a carriage return and press Alt+Enter on your keyboard. For Mac, use Control+Option+Return or Control+Command+Return.
The carriage return or line break will occur at that place.
- Do this for every carriage return required in the cell.
Method 2 – Using Excel CHAR, CONCATENATE, and TEXTJOIN Functions
The character used for carriage return is different in Windows and Mac. For Windows it is CHAR(10), and for Mac it is CHAR(13). We can combine this character with other functions to get a carriage return.
In this example, we show the formulas for Windows. Simply replace CHAR(10) with CHAR(13) for Mac.
- Use the following function with ampersand to produce a string including a carriage return:
=B5&" "&CHAR(10)&C5&" "&CHAR(10)&D5
- Alternatively, use the CONCATENATE function:
=CONCATENATE(B6,CHAR(10),C6,CHAR(10),D6)
- Or, use the TEXTJOIN function (only available in Excel 365, Excel 2021, and Excel 2019 versions):
=TEXTJOIN(CHAR(10),TRUE,B7:D7)
Method 3 – Using the Find and Replace Feature
If you have a worksheet with multiple one-line entries, you may need to break lines to use the data easily. To save yourself the tedious and time-consuming task of doing this manually, use the Find and Replace feature.
In this method, we have some data in cells separated by commas. We will add a carriage return in place of a comma.
- Press Ctrl+H to open the Find and Replace dialog box.
- Select the character you want to replace with a carriage return. We are replacing “, “, so we put that in the Find what field.
- In the Replace with field, press Ctrl+J. This will insert the carriage return in that field.
- Click on Replace All and resize the cells to get your desired view.
Method 4 – Using Carriage Return in VBA
- Go to the Developer tab and select Visual Basic from the Code group.
- Select Insert and then Module in the VBA window.
- Insert the following code in the module:
Sub CRinMacro()
MsgBox "First Line" & vbCrLf & "Second Line"
End Sub
- Press F5 to run the code.
You will get a carriage return where vbCrLf is used.
Read More: Insert Carriage Return in Excel Cell
How to Remove a Carriage Return in Excel
Carriage returns may appear when you copy texts from a website or use downloaded CSV or Text files in Excel. Carriage returns can be removed from cells in 3 ways:
Method 1 – Using the Find and Replace Feature
- Open the Find and Replace dialog box by pressing Ctrl+H.
- Press Ctrl+J to insert the carriage return in the Find what field.
- Insert the delimiter with which you want to replace the carriage return in the Replace with field.
- Select Replace All and all the carriage returns in the spreadsheet will be replaced.
Method 2 – Using TRIM and SUBSTITUTE Functions
In the dataset below, we have some personal information in Cells B5 and B6. After removing the carriage returns, the results will be like Cell C5 and C6 respectively.
- Combine the TRIM and SUBSTITUTE functions to remove carriage return from a cell as follows:
=TRIM(SUBSTITUTE(SUBSTITUTE(B5,CHAR(13),""),CHAR(10),", "))
- Use a space in place of the comma if desired.
- Alternatively, use just the SUBSTITUTE function to replace the carriage return with another character as follows:
=SUBSTITUTE(B6,CHAR(10),", ")
=CLEAN(B5)
.Read More: Replace Carriage Return with Comma
Method 3 – Using VBA Code
We have some information in Cell B5 and B6 with carriage returns. We will replace the carriage returns with a comma followed by a space using VBA code.
- Go to the Developer tab >> select Visual Basic.
- From the Visual Basic window, select Insert >> Module.
- Paste the following code in the Module window:
Sub Delete_Carriage_Returns()
Dim iRange As Range
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
For Each iRange In ActiveSheet.UsedRange
If 0 < InStr(iRange, Chr(10)) Then
iRange = Replace(iRange, Chr(10), ", ")
'the carriage returns will be replaced by a comma along with a space
End If
Next
Application.ScreenUpdating = True
Application.Calculation = xlCalculationAutomatic
End Sub
- Select the range.
- Go to Macros in the Developer tab.
- From the Macro dialog box, select the code and click Run.
You will get results like the image below.
Read More: Remove Carriage Returns in Excel
Tips for Using the Carriage Return in Excel
- If the row height isn’t set to auto-adjust with the text, the cells with carriage returns will not display the whole text. Use the Wrap Text feature from the Home tab to display the whole text.
- Add multiple carriage returns to increase readability.
- When your formula gets relatively large, you might want to add carriage returns inside the formula. This helps users understand them better, but won’t affect the formula’s functionality.
Things to Remember
- By default, pressing Enter will take you to the cell below in Excel. Use Alt+Enter if you want to apply the carriage return directly in the Excel cell.
- Use text wrapping if your cell values with carriage returns aren’t displaying fully.
- The Find and Replace feature or the SUBSTITUTE function can replace carriage returns with one specific character at a time, and vice versa.
- The TRIM function removes all the spaces from a text. Use with caution, as it can remove necessary spaces too.
- When transferring or exporting data with carriage returns from Excel to other applications, some may treat them as different characters.
Frequently Asked Questions
How to add carriage return in Excel for multiple cells?
Use formulas and the Find and Replace features. Using the latter, you can also add them over the entire sheet.
How do I adjust the row height to display the entire text with carriage returns?
To adjust the rows to the texts, double-click below the row number on the left of the spreadsheet. It will automatically adjust to the number of lines created by carriage returns.
Can I export or print Excel data with carriage returns?
Yes, in some applications. However, some applications may have different character codes for the carriage return, so you have to consider the target file format and printer settings in such scenarios.
Download the Practice Workbook
Carriage Return in Excel: Knowledge Hub
- Find Carriage Return
- Remove Carriage Return Text to Columns
- [Fixed!] Carriage Return in Excel Not Working
- Find and Replace Carriage Return
<< Go Back to Text Formatting | Learn Excel
Get FREE Advanced Excel Exercises with Solutions!