To find and replace a hard return inside Excel cells on Windows, select the cells you want to change, press Ctrl+H, click in the Find what box, press Ctrl+J, and enter a space or leave Replace with empty. The search box will look blank even though it contains the line-break character. Choose Replace to check one match, or Replace All to change every match in the selected range or worksheet.
In Excel, a hard return inside a cell is usually a manual line break made with Alt+Enter. Replacing it can join split text, remove unwanted blank lines, or make imported data easier to sort and analyze. Save a copy first if the original wording or layout matters, and check the results before applying the change to a large worksheet.
What You’ll Need
- Excel for Microsoft 365 on Windows, or Excel for Mac or the web if you prefer the alternatives described below.
- A worksheet containing cells with line breaks. A visible break may have been entered manually or brought in when data was imported.
- Decide what should replace each break: a space for joined words, a comma or other separator when appropriate, or nothing to remove the break entirely.
- For bulk edits, a saved copy of the workbook is a useful safeguard. Replace All changes cell contents and cannot be reversed after you close the workbook and its undo history is lost.
Step-by-Step
- Identify the cells to change. Click a cell that appears to contain multiple lines and inspect its contents in the formula bar. A line break inside one cell is different from text merely wrapping onto a second display line. If you can move through the cell’s content and see separate lines within the same value, it likely contains a hard return. You can also double-click the cell or press F2 to inspect it; press Esc afterward if you do not intend to edit it.
- Choose the scope before opening Replace. To limit the operation to a particular block, select that range first. To search the entire active worksheet, leave just one cell selected. Excel’s Find and Replace works in the active sheet by default, not automatically through every sheet in the workbook. If the workbook has several relevant sheets, repeat the operation on each one, checking the selected sheet each time.
- Open the Replace tab. In Excel for Microsoft 365 on Windows, press Ctrl+H, or use Home > Find & Select > Replace. In Excel for Mac, use Edit > Find > Replace or the Home tab’s Find & Select command if it is available in your ribbon layout. The dialog provides a Find what field and a Replace with field.
- Enter the hard return in Find what. Click inside the Find what box and press Ctrl+J on Windows. The box will appear empty; that is expected. Ctrl+J inserts the line-feed character Excel uses for the usual in-cell line break, rather than displaying a visible symbol. Do not type the letters C, T, R, and L, or the characters “^J”; the shortcut is a key combination, not text to enter.
- Specify the replacement. Click Replace with and type a single space if you want words on separate lines to become one readable phrase. For example, “North” followed by a hard return and “Sales” becomes “North Sales.” Leave Replace with completely empty to remove the break without inserting another character. If the break separates list items or address parts, consider whether a comma, semicolon, or another separator would preserve meaning better than a space.
- Test a single match. Select Find Next, then use Replace once to change that match. Inspect the cell and confirm that the words have joined as intended and that punctuation or spacing still looks right. If Excel reports no matches, see Troubleshooting below before changing search settings or trying a formula.
- Apply the change to the chosen scope. When the test is correct, choose Replace All. Read Excel’s confirmation message for the number of replacements and check several changed cells, including cells near the start and end of the selected range. Close the dialog and review the worksheet. If the result is wrong, immediately use Ctrl+Z on Windows to undo the operation; on Mac, use Command+Z.
For Excel for the web, the desktop shortcut and dialog behavior can vary with the browser and version. If the Find what box will not accept Ctrl+J, open the workbook in the desktop app and use the Windows steps above. Alternatively, use a helper formula to create cleaned text, review it, and then copy the results and paste them as values if you need to replace the original contents.
On Mac, if the Replace dialog does not accept a line break through Ctrl+J, the formula approach is a dependable alternative. For a cell whose text is in A2, the formula below replaces the usual line-feed character with a space:
With the original text in A2, enter =SUBSTITUTE(A2,CHAR(10)," ") in another cell. If A2 contains “North”, a line break, and “Sales”, the result is North Sales. Fill the formula down for other rows, review the results, and copy and paste values over the original cells only when you are satisfied.
Common Mistakes
- Expecting Ctrl+J to show a symbol. The Find what field appears blank because the line-feed character is not visible. That does not mean the keystroke failed. Select Find Next to test it against a cell you know contains a break.
- Using the wrong replacement. Removing a break with an empty replacement can turn “First” and “Last” into “FirstLast.” A space is usually safer for ordinary words, but it may be wrong for codes, postal addresses, or deliberately formatted lists. Decide what the text should mean after joining before replacing every match.
- Searching only part of the data by accident. If a range is selected, Excel may restrict the operation to that selection. Conversely, leaving one cell selected and choosing Replace All can affect every matching cell on the sheet. Confirm the scope before the bulk action.
- Confusing a hard return with wrapped text. Wrap Text makes long content appear on multiple display lines without putting a line-break character in the value. Ctrl+J will not find that visual wrapping. Widen the column or temporarily turn off Home > Wrap Text to help distinguish the two.
- Assuming every imported break is the same character. A manually entered Excel line break is generally a line feed, CHAR(10). Data imported from another system may also contain a carriage return, CHAR(13), or a carriage-return/line-feed pair. A search for the usual line feed may not clean every imported value.
Tips
- Use Replace once before Replace All, especially when cells contain a mixture of names, addresses, notes, or formatted lists. A quick spot check can reveal whether a space is enough or whether another separator is needed.
- If the unwanted break is at the beginning or end of a cell, replacing it with a space can leave an extra leading or trailing space. You can remove those later with Excel’s TRIM function, but remember TRIM also reduces repeated ordinary spaces between words to single spaces.
- For data that may contain both carriage returns and line feeds, a helper formula can remove carriage returns first and convert line feeds to spaces. With the source text in A2, use
=SUBSTITUTE(SUBSTITUTE(A2,CHAR(13),""),CHAR(10)," "). If A2 contains “North”, a carriage return plus line feed, and “Sales”, the result is North Sales. This is useful for imported text; review the output before replacing source data. - Find and Replace changes cell contents, not necessarily their appearance. A cell may remain set to Wrap Text after its hard return is removed. If it still displays on multiple lines, check column width, row height, and Home > Wrap Text before assuming the replacement failed.
- For large or important workbooks, keep the source column and put cleaned results in a neighboring column first. Compare a sample of original and cleaned values, then paste values back only after confirming that no meaningful separators or leading zeros have been lost.
Troubleshooting
Find Next says no matches. First confirm that the cell contains a line break rather than wrapped text. Click the cell and inspect it in the formula bar or edit mode. Then verify you entered Ctrl+J while the cursor was in Find what, not Replace with. If a range is selected, make sure the cell is inside it. Also check whether the dialog is searching formulas or values if the available search options are shown; for ordinary text cleanup, search values.
The replacement runs words together or leaves odd spacing. Undo the replacement, reopen the dialog, and test with a space in Replace with. If imported text has a carriage return and a line feed, replacing only one character can leave the other behind. In a helper column, with source text in A2, use =SUBSTITUTE(SUBSTITUTE(A2,CHAR(13),""),CHAR(10)," ") to remove carriage returns and turn line feeds into spaces. Check for doubled spaces or unexpected punctuation in the results before using them.
Only some cells change. The cells may contain different break characters, or the replacement may have been limited to a selected range. Try the helper formula on a cell that did not change and compare the result. For a mixed import, the formula above handles the common CHAR(13) and CHAR(10) characters. If the source contains other control characters, inspect how it was exported or use a cleaning step suited to that source rather than repeatedly applying Replace All without checking.
The text still looks like it has a break. Check whether the cell is simply wrapping at the column edge. Widen the column or toggle Wrap Text to see whether the display changes. Also check row height and alignment. A hard return has been removed when the underlying text is continuous; the way Excel displays that text can still create multiple visual lines.
You changed too much. Use Ctrl+Z on Windows or Command+Z on Mac immediately. If you have made other edits since the replacement, undo may also reverse those later actions, so review each undo step. If the workbook is already saved and closed, restore a backup or version history if available; this is why saving a separate copy before a broad replacement is prudent.
Frequently Asked Questions
What does “hard return” mean in Excel?
A hard return is a line break stored inside a cell’s value, commonly inserted with Alt+Enter on Windows. It separates text into lines within one cell. It is not the same as text wrapping automatically because a column is too narrow.
How do I insert a hard return in a cell?
While editing a cell in Excel for Windows, place the cursor where the break should go and press Alt+Enter. In Excel for Mac, use Control+Option+Return. If Wrap Text is off, the line break can still be in the cell even if its display is not obvious.
Can I replace a hard return with a comma instead of a space?
Yes. In the Replace dialog, enter a comma and a space in Replace with. Test the change first because existing punctuation may make a doubled comma or an awkward phrase. Choose a separator that fits the type of content.
Does Replace All affect every worksheet?
Normally, Replace All acts on the active worksheet, or on the selected range within that sheet. It does not automatically clean every sheet in the workbook. Repeat it sheet by sheet, checking the active tab and selection before each run.
Why does Ctrl+J not work in Excel for Mac or the web?
The shortcut may not place the line-feed character into the search box in those interfaces. Use the desktop Windows dialog for the Ctrl+J method, or use a helper formula with CHAR(10). In Excel for Mac, start from Edit > Find > Replace when the dialog is available.
Will replacing a hard return change the cell’s formatting?
It changes the cell’s content, not its number format, font, or other formatting. Wrap Text can remain enabled, and narrow columns can still make continuous text appear on more than one line. Check the value and the display separately.
Related
- How to Enable Transpose in Excel
- How to Enable Strikethrough in Excel with Shortcuts
- How to Enable the Text Import Wizard in Excel for CSV Files
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- How to Present PowerPoint and See Your Speaker NotesTo present PowerPoint while keeping your notes visible, connect your computer to a second screen, set the displays…
- Excel Consolidate Lists With Duplicates: Keep or Remove?To combine lists and keep repeated items in Excel for Microsoft 365 on Windows, enter =VSTACK(A2:A5,B2:B4) in an…
- How to Remove Track Changes in Word Without Losing EditsTo remove tracked edits in Word, save a copy of the document, open Review > Accept, and choose…
- How to Divide a Cell in Half in Excel: 3 OptionsTo divide a cell in half in Excel, first choose what you mean by “divide”: Excel cannot turn…
- Excel Border Shortcut: Apply All or Outline BordersIn Excel for Microsoft 365 on Windows, select the cells and press Ctrl+Shift+& to apply an outline border.…
- Excel Solver: Where to Find It and How It Works in 365Yes—Excel includes Solver as an add-in, but it may not be enabled yet. In desktop Excel for Microsoft…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.