To remove repeated spaces in Excel, select the cells and use Home > Find & Select > Replace to replace two spaces with one, repeating until no matches remain. For a more complete cleanup—including extra spaces at the start or end of text—use a helper column with =TRIM(A2), then copy the results and paste them as values. Make a copy of important data first, especially before using Replace All.
What You’ll Need
- An Excel workbook with the text you want to clean.
- Either the cells to edit directly, or an empty helper column if you want to review cleaned results before replacing the originals.
- A backup copy of the workbook if the source data is important or difficult to recreate.
Step-by-Step
- Choose the cleanup method. Find and Replace is quick when you only need to reduce repeated, ordinary spaces between words. A formula is usually safer when you also want to remove spaces at the beginning or end of a cell, or when you want to check the cleaned text before changing the source. Excel’s TRIM function changes spacing in text; it does not alter numeric values as numbers.
- Save a copy or select only the intended range. If you are editing data directly, use File > Save As to keep an untouched copy, or first select just the cells you want to change. Selecting a range matters: if no range is selected, a replace operation can affect matching text throughout the worksheet. If the data is in an Excel table, you can select the relevant column’s data cells rather than the whole sheet.
- Open Replace for a direct cleanup. In Excel for Microsoft 365 on Windows, go to Home > Find & Select > Replace, or press Ctrl+H. In the Find what box, enter exactly two ordinary spaces by pressing the spacebar twice. In the Replace with box, enter one ordinary space. Spaces are invisible in these boxes, so take care not to type a leading or trailing space in either field.
- Check the search settings and scope. In the Replace dialog, confirm that the search is looking in the values you intend to change, and use the within-sheet option if it is shown. If you selected a range before opening Replace, confirm that Excel is searching that selection rather than the entire sheet. Avoid changing settings such as Match case or Match entire cell contents unless your task specifically requires them; they are not needed to find double spaces.
- Replace, then repeat if necessary. Choose Replace All and note how many replacements Excel reports. A cell containing three consecutive spaces may still contain a double space after one pass; a longer run can take more than one pass to reduce to single spaces. Run Replace All again until Excel reports that it could not find anything to replace. If you want to check each change first, use Find Next and Replace instead of Replace All.
- Use TRIM when you want a thorough text cleanup. With the original text in A2 and an empty helper column available, enter
=TRIM(A2)in the helper cell beside it. This returns the text with leading and trailing ordinary spaces removed and runs of ordinary spaces between words reduced to one. The formula assumes A2 contains the first cell you want to clean; change A2 to the actual source cell if your data is elsewhere. - Fill the formula down and review the results. Select the formula cell, then drag its fill handle down the rows, or double-click the fill handle to fill alongside a neighboring column of data. Check several results, including cells with multiple spaces, a single space, and no space. Blank source cells should remain blank. If the formula displays as text rather than calculating, see Troubleshooting below.
- Replace the original data only after checking. If the cleaned results look right, select the helper results and copy them. Select the original cells, then use Home > Paste > Paste Values so the cleaned text replaces the formulas with fixed text. Confirm the correct destination before pasting. Keep the helper column until you have verified the replacement, then remove it if you no longer need it.
On Mac, use the Home tab’s Find & Select > Replace command if available in your Excel ribbon; the exact ribbon layout can vary by release. On Excel for the web, look for Find and Replace on the Home tab. The TRIM formula works in current desktop Excel and Excel for the web. If your regional Excel settings use semicolons as formula separators, enter the formula using the separator your installation expects.
Common Mistakes
Replacing one space instead of two: If Find what contains just one space and Replace with is empty, Replace All removes every ordinary space, including spaces between words. To collapse double spaces, search for two spaces and replace them with one.
Expecting one replacement pass to fix every long run: Replacing two spaces with one reduces a run, but a cell with three or more adjacent spaces can still have a repeated pair afterward. Repeat the operation until there are no matches, or use TRIM for ordinary spaces in text.
Assuming Find and Replace removes spaces at the edges: Searching for two spaces will not remove a single space before the first word or after the last word. The TRIM formula does remove those ordinary leading and trailing spaces.
Overwriting the source before checking: Replace All changes the selected text directly and may be difficult to reverse after other edits. A helper column lets you compare original and cleaned text first. Save a copy before a large cleanup.
Confusing ordinary spaces with other characters: TRIM handles ordinary spaces, not every invisible character. A nonbreaking space copied from a web page, a tab, or a line break may look like a space but remain after TRIM. Use the troubleshooting steps below if a cell still appears uneven.
Tips
- Use a helper column for imported lists. Names, addresses, and product descriptions often need review before the original values are replaced. Keeping the source and cleaned result side by side makes unexpected changes easier to spot.
- Check representative rows, not only the first one. Look at a row with double spaces, one with several spaces, one with punctuation, and one that appears blank. Text from different sources can contain different kinds of whitespace.
- Keep spaces that carry meaning. Repeated spaces may be deliberate in fixed-width text, codes, or carefully formatted labels. Do not apply TRIM or Replace All to such data without checking how it is used.
- Remember that formulas update with their source. A helper formula continues to calculate from the original cell until you paste its result as a value. If you want a permanent cleaned copy, use Paste Values after reviewing.
- For data you clean regularly, keep the steps consistent. Use the same selected columns and review procedure each time. This reduces the chance of accidentally changing notes, formulas, or other fields that were not part of the cleanup.
Troubleshooting
Replace All says no matches were found. The cells may not contain two ordinary spaces. Click inside a problem cell and inspect the text in the formula bar. Try entering the two spaces in Find what again, making sure the box is not empty and does not contain a different number. Also confirm the search scope and that the target cells are not excluded by a selection or search setting. If the text came from a website, it may contain nonbreaking spaces instead.
TRIM leaves spaces that still look doubled. A common cause is a nonbreaking space, character code 160, which TRIM does not remove on its own. With the original text in A2 and a helper cell beside it, use =TRIM(SUBSTITUTE(A2,CHAR(160)," ")). This replaces nonbreaking spaces with ordinary spaces and then trims the result. Check the output before pasting it over the original. The formula addresses that particular character; it does not guarantee removal of every possible invisible character.
The formula appears in the cell instead of its result. Confirm that the cell is not formatted as Text. Change its format to General, then select the cell, press F2, and press Enter to make Excel evaluate the formula. Also check that the formula begins with an equals sign and that Show Formulas is not turned on. On Windows, Ctrl+` toggles the display of formulas; the key is usually the grave accent near the top-left of the keyboard.
The cleaned text is in the wrong rows or overwrote other information. Undo immediately with Ctrl+Z on Windows, or Command+Z on Mac, if the action is still available. If you used a helper column, check that each result lines up with its source before copying. When pasting values, select the matching original range and verify its first and last rows before completing the paste.
Spaces remain around line breaks or tabs. TRIM does not remove every kind of whitespace, and a line break can make text appear separated even when there are no double spaces. If the content includes tabs or line breaks, identify the unwanted character before replacing it; a broad replacement can remove meaningful formatting. For complex imported data, clean a copy and inspect the results closely.
Frequently Asked Questions
Does TRIM remove all double spaces in Excel?
TRIM reduces runs of ordinary spaces between words to one and removes ordinary spaces at the start and end of text. It does not handle every whitespace character, including nonbreaking spaces, tabs, and line breaks.
Can I remove double spaces without a formula?
Yes. Use Home > Find & Select > Replace, search for two spaces, and replace them with one. Repeat Replace All until there are no more matches. This method changes the selected text directly and does not remove single leading or trailing spaces.
Will Find and Replace change every worksheet?
Not necessarily. The Replace dialog has a search scope, and a selected range can limit what is changed. Check the dialog’s scope before choosing Replace All. If you intend to clean several sheets, handle each sheet deliberately and review the replacement count.
How do I remove spaces at the start and end of cells?
Use a helper formula such as =TRIM(A2) when the source text is in A2. Review the result, then copy it and use Paste Values if you want to replace the original text. Find and Replace for two spaces does not remove single edge spaces.
Why does TRIM not fix spacing copied from a website?
Copied text may use a nonbreaking space instead of an ordinary space. TRIM does not remove that character directly. Replace it with an ordinary space using SUBSTITUTE and CHAR(160), then apply TRIM, as shown in Troubleshooting.
Can I undo Replace All?
Usually, Ctrl+Z on Windows or Command+Z on Mac reverses the most recent action, provided you have not closed the workbook or performed actions that clear the undo history. For important data, save a copy first rather than relying on Undo.
Related
- Excel Conditional Formatting for Duplicate Values
- Insert a Yes/No Dropdown in Excel: A Step-by-Step Guide
- How to Insert a Row in Excel on a Laptop, Step by Step
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Text Stay in Cell? Wrap, Clip, or Shrink TextYes. In Excel for Microsoft 365 on Windows, select the cells and choose Home > Wrap Text to…
- Excel Freeze Specific Panes: Rows, Columns, or BothTo freeze specific rows and columns in Excel for Microsoft 365 on Windows, select the cell immediately below…
- How to Create Mail Rules in Outlook and Manage ThemCreate a mail rule in Outlook by choosing a condition, such as a sender or a subject phrase,…
- Import Multiple CSV Files into Excel: Methods and TipsYes. In Excel for Microsoft 365 on Windows, you can import multiple CSV files and either combine their…
- How to Delete a Blank Page in Word: Quick, Simple FixesTo delete a blank page in Word, show formatting marks with Ctrl+Shift+8 on Windows or Command+8 on Mac,…
- How to Edit Mail Merge Fields in Word Documents Step by StepTo edit a mail merge field in Word, select it in your document and use the Mailings tab…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.