To remove every ordinary space from selected cells in Excel for Microsoft 365 on Windows, select the cells, press Ctrl+H, enter one space in Find what, leave Replace with empty, and choose Replace All. This shortcut deletes spaces between words as well as spaces at the start or end, so work on a copy or check your selection first if you need to keep word spacing.
What You’ll Need
- An Excel workbook with the text you want to change.
- A clear idea of whether you want to remove every space or only clean up extra spaces at the beginning, end, or between words.
- For important data, a saved copy of the workbook or a duplicate column to preserve the original values until you have checked the result.
Step-by-Step
- Decide which spaces should go. Replace All removes every standard space character in the cells covered by the search. For example, it changes North Bay to NorthBay and North Bay to NorthBay. If you want North Bay to remain readable while removing only extra spaces, skip to the formula option below instead.
- Save a copy or make a backup column. Replace All changes the cell contents directly. Press Ctrl+C to copy the data and paste it into a spare column, or save a separate copy of the workbook using File > Save As. This is especially useful when the cells contain product codes, addresses, or other information that would be difficult to reconstruct.
- Select only the cells you intend to change. Drag across the relevant range, or click the first cell and hold Shift while selecting the last. You can also select a column by clicking its letter, but do that only if every cell in that column should be checked. If no range is selected, Excel may search the active worksheet, so do not assume the operation is limited to the visible table.
- Open Find and Replace. Press Ctrl+H on Windows. In the dialog, the Find what and Replace with boxes control the change. On Excel for Mac, use Control+H to open Replace; keyboard mappings can vary by keyboard settings, so use Home > Find & Select > Replace if that shortcut does not open the dialog. In Excel for the web, try Ctrl+H or open the Replace command from Home > Find & Select.
- Enter one space in Find what. Click that box and tap the spacebar once. The box will look empty, but it contains a space. Do not type the word “space,” and do not enter quotation marks. A helpful check is to tap the spacebar between another character temporarily, confirm there is one gap, then remove the extra character without removing the space.
- Leave Replace with completely blank. Click Replace with and make sure it contains no characters, including a space. The instruction is to replace each found space with nothing. If you put a space in both boxes, Excel will replace spaces with spaces and the text will not change.
- Check search options before replacing. Expand Options if needed. Set Within to Sheet when working on one worksheet, and check that Match entire cell contents is not selected. If available, set Look in to Values when you want to work with displayed text rather than search formula text. If you need to change a whole workbook, choose Workbook deliberately and review which sheets are included. Options may look slightly different between Windows, Mac, and web versions.
- Use Replace All and read the result message. Click Replace All. Excel reports how many replacements it made. If the number seems unexpectedly high, or you are unsure about the range, use Ctrl+Z straight away to undo the change, then check the selection and search options before trying again. Avoid making other edits first, because undo reverses the most recent actions in order.
- Inspect the changed cells. Check a few examples, including any entries with multiple words or spaces at the ends. Verify that codes, names, and other important text still mean what you expect. If you used a backup column, compare it with the changed results before removing the backup.
- For extra spaces rather than all spaces, use a helper formula. With text in A2, enter
=TRIM(A2)in B2, then fill the formula down. TRIM removes spaces at the beginning and end and reduces repeated spaces between words to a single space. For example, if A2 contains two spaces before “North,” two between “North” and “Bay,” and one at the end, the result is North Bay. Copy the finished results and use Paste Special > Values if you need to replace the original formulas with plain text.
Common Mistakes
- Removing spaces that carry meaning. Replace All turns Unit 4 West into Unit4West. This may be right for a code that must contain no spaces, but it is usually wrong for names, addresses, and sentences. Use TRIM when you want to tidy spacing without joining words.
- Searching for an empty string by mistake. The Find what box must contain one actual space. It is easy to click the box and assume it is filled when it is not, because a single space cannot be seen. Replace All with an empty Find what can behave very differently from the intended cleanup.
- Leaving a space in Replace with. A blank-looking replacement box can contain a space too. Click the box and press Backspace to ensure it is empty before starting.
- Searching too broadly. If you do not select a range, or choose Workbook instead of Sheet, you can change more data than planned. Confirm the selected cells and the Within setting before using Replace All.
- Expecting TRIM to remove every kind of whitespace. TRIM handles ordinary spaces, not every invisible character that can arrive from websites or exported files. A nonbreaking space may look just like a normal space but remain after using the shortcut or TRIM.
Tips
- Use Replace All for code cleanup. It is quick when the intended result is to join characters, such as converting AB 123 to AB123. Test a few representative entries first, especially if codes have inconsistent formats.
- Use TRIM for readable text. It preserves one ordinary space between words, so it is usually more appropriate for customer names, locations, and descriptions. The formula returns a cleaned result in another cell, leaving the source intact until you choose to replace it.
- Keep the selection narrow. Applying Replace All to a selected range is safer than running it on an entire worksheet. Filtered tables can still contain hidden rows; consider whether those rows should be changed too before you replace text.
- Check formulas and linked data. A formula may display text with spaces even though the underlying cell contains a formula. Keep a copy, and check Look in and the selected range carefully rather than replacing characters throughout formula text unintentionally.
- Remember that Find and Replace is not a formatting tool. It changes matching cell content. If cells merely look as though they have extra space because of indentation, alignment, or column width, changing the text will not fix the visual layout.
Troubleshooting
Replace All reports zero changes. Confirm that Find what contains one ordinary space and that the selected cells really contain that character. Check whether Match entire cell contents is enabled, whether the search is limited to the wrong sheet, and whether Look in is set appropriately. If the text came from a website, try cleaning a copy with a method for nonbreaking spaces, as described below.
The result joins words together. That is the expected effect of deleting every space. Undo with Ctrl+Z on Windows, then use =TRIM(A2) in a helper column if you want one space between words. With the original text in A2, that formula turns North Bay into North Bay, not NorthBay.
Some spaces remain after Replace All or TRIM. The characters may be nonbreaking spaces, tabs, or other whitespace rather than ordinary spaces. If you suspect nonbreaking spaces, test a helper formula on a copied value. With the imported text in A2, enter =SUBSTITUTE(A2,CHAR(160)," ") in B2 to convert nonbreaking spaces to ordinary spaces. For example, if A2 contains North, a nonbreaking space, and Bay, B2 returns North Bay. You can then apply TRIM to the converted result or use Find and Replace on a checked copy. CHAR(160) represents the common nonbreaking-space character; other imported characters may need separate handling.
Ctrl+H does something unexpected. Click a worksheet cell first and try again. On Mac, use Control+H or the ribbon command Home > Find & Select > Replace. In a browser, a keyboard shortcut may be intercepted or behave differently; use the Excel ribbon command instead.
You changed the wrong cells. If the change is still the latest action, press Ctrl+Z on Windows or Command+Z on Mac immediately. If you have made several edits since the replacement, undo may also reverse those later edits. This is why saving a copy or keeping an original column is a safer approach for important data.
Frequently Asked Questions
What is the shortcut to remove spaces in Excel?
On Windows, Ctrl+H opens Find and Replace. Find one space, leave Replace with empty, and choose Replace All. Select the intended cells first so you do not change a larger area by accident.
Can I remove spaces only from the beginning and end of a cell?
Find and Replace cannot target only the start or end using a simple space search. Use TRIM in a helper column. It removes leading and trailing ordinary spaces and also reduces repeated spaces inside the text to one.
How do I remove spaces without joining words?
Use TRIM rather than Replace All. For example, North Bay becomes North Bay, preserving a single space between the words. Replace All would produce NorthBay.
Will Find and Replace change every worksheet?
Not necessarily. The Within setting determines whether Excel searches the current sheet or the workbook. Check that setting before Replace All, and select the range you want to edit when working on just part of a sheet.
Does this shortcut work in Excel for Mac?
Excel for Mac commonly uses Control+H for Replace, while Windows uses Ctrl+H. If the shortcut differs on your setup, open Replace from Home > Find & Select.
Why does a space remain when I cannot see it?
The character may be a nonbreaking space copied from a webpage or report. Convert it to an ordinary space with a helper formula using CHAR(160), then clean or replace the ordinary spaces as needed. Keep the original data until you confirm the result.
Related
- Excel Day Hour Minute Second Format: Display Durations
- Excel Day Counter: Count Days Between Dates
- Excel Date Difference: Days, Workdays, and Inclusive Counts
Try it: the Formula Explainer: paste any formula and see each function and reference in plain English.
More in Formulas & functions
- Power Query XLOOKUP From Another Table: How It WorksPower Query does not run the Excel XLOOKUP function inside a query. To return columns from another table,…
- Power Query Filter: How to Filter Rows in ExcelTo filter in Power Query, open the query in Power Query Editor, select the filter arrow in a…
- Excel Formula for Current Date: TODAY ExplainedIn Microsoft Excel for Microsoft 365 on Windows, enter =TODAY() in a cell to display the current date.…
- Excel Day Name from Date: Formulas, Formats, and FixesTo show the day name for a date in Excel, enter =TEXT(A2,"dddd") in another cell, assuming A2 contains…
- Excel Text Comparison: Formulas, Case, Spaces, and ErrorsWith the text values in A2 and B2, compare them in Excel using =A2=B2 for a case-insensitive check…
- Sumifs with date range?Learn how SUMIFS handles dates, boundaries, months, extra criteria, and common errors, with clear Excel examples to help…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.