How to delete spaces in excel
Tutor 5 (273 Reviews)
Excel Tutor
Still stuck with a Excel question
Ask this expertAnswer
TRIM removes extra spaces from text, leaving single spaces between words and removing leading and trailing spaces.
How to remove leading, trailing, and extra spaces (use TRIM)
Use TRIM when you want to clean irregular spacing but keep single spaces between words.
-
Insert a helper column next to your data (for example, column B if your data is in A).
-
In the first helper cell enter:
=TRIM(A2). -
Press Enter and drag the fill-handle down to apply to the range.
-
Copy the helper column and Paste → Values on top of the original column to replace the dirty data.
TRIM targets the normal ASCII space (code 32) and collapses runs of those spaces.
How to remove every space (no spaces left between words)
Use SUBSTITUTE when you need to delete every regular space character inside a string.
-
Insert a helper column.
-
Enter:
=SUBSTITUTE(A2," ",""). -
Press Enter and fill down.
-
Copy the results and Paste → Values over the original cells if needed.
SUBSTITUTE replaces exact characters you specify, so it removes every regular space when you replace " " with "".
How to remove nonprinting or hidden characters
Use CLEAN to strip many nonprinting characters that TRIM and SUBSTITUTE do not remove.
-
Use
=CLEAN(A2)to remove common nonprinting ASCII characters (codes 0–31). -
Combine with TRIM to remove extra spaces as well:
=TRIM(CLEAN(A2)). -
Copy and Paste → Values when finished.
CLEAN removes the first 32 nonprinting ASCII characters; some Unicode nonprinting characters require extra handling.
How to remove nonbreaking or special spaces (CHAR(160))
Some imported data contains nonbreaking spaces (CHAR(160)) that TRIM ignores. Replace them with normal spaces, then TRIM.
-
Use
=TRIM(SUBSTITUTE(A2,CHAR(160)," ")). -
Fill down and Paste → Values to finalize.
Replacing CHAR(160) with CHAR(32) (a normal space) lets TRIM collapse them properly.
How to remove spaces using Find & Replace
Find & Replace deletes spaces quickly across ranges when you want to remove all space characters.
-
Select the range to change or click a sheet header to select all cells.
-
Open Replace: press Ctrl + H on Windows or Command + H on Mac.
-
In Find what type a single space (press Spacebar once).
-
Leave Replace with blank.
-
Click Replace All.
Find & Replace removes every instance of the exact character you enter, so use it when you want every space removed from the selected area. Keyboard shortcut differences are standard: Ctrl+H on Windows and Command+H on Mac.
How to remove spaces inside numbers (preserve numeric type)
Numbers with spaces may be stored as text. Convert cleaned text back to numbers:
-
Remove spaces with
=SUBSTITUTE(A2," ",""). -
Wrap with VALUE to convert:
=VALUE(SUBSTITUTE(A2," ","")). -
Fill down and Paste → Values.
VALUE converts a text string that looks like a number into a numeric value. Use this when numeric calculations must follow.
When should I combine methods?
Use a combination when data is messy.
-
Use
=TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," ")))to 1) replace nonbreaking spaces, 2) remove nonprinting chars, and 3) collapse extra normal spaces. -
Fill down and Paste → Values once data is clean.
Combining functions handles more edge cases than any single function.
Can I remove spaces for an entire workbook at once?
Yes. Use Find & Replace while the workbook is active and the search target is set to Workbook.
-
Press Ctrl + H (Windows) or Command + H (Mac).
-
Click Options and set Within: Workbook.
-
Enter a single space in Find what and leave Replace with blank.
-
Click Replace All.
Use workbook-wide replace with caution; it changes every matching cell.
What if TRIM doesn’t remove spaces, I see?
TRIM may not remove nonbreaking or other special spaces; run SUBSTITUTE with CHAR(160) or CLEAN first, then TRIM.
How to keep formulas from breaking when you Paste → Values
Use these steps to safely replace original data with cleaned results.
-
After formulas return cleaned text, select helper column.
-
Press Ctrl + C (Windows) or Command + C (Mac).
-
Right-click target column → Paste Special → Values.
-
Delete helper column.
Pasting values replaces formulas with their outputs so subsequent edits do not recalc or reintroduce old data.
What differences exist between Windows and Mac?
Find & Replace and most functions behave identically across Excel for Windows and Excel for Mac. Keyboard shortcuts differ:
-
Replace dialog: Ctrl + H on Windows, Command + H on Mac.
-
Find dialog: Ctrl + F on Windows, Command + F on Mac.
Ribbon locations for functions are the same in modern Excel versions.
Best-practice checklist
-
Back up your workbook before mass replacements.
-
Work on a copy column and Paste → Values over originals only after verifying results.
-
Combine SUBSTITUTE, CLEAN, and TRIM for imported or web-scraped data.
-
Use VALUE when cleaned text should be numeric.
-
Test on a small sample before Replace All across a workbook.
Get Online Tutoring or Questions answered by Experts.
You can post a question for a tutor or set up a tutoring session
Answers · 1
How to sort by highlighted cells in excel
Answers · 1
How to sort excel by column and keep rows together
Answers · 1
How to sort by time in excel
Answers · 1
How to sort alphabetically in excel by last name
Answers · 1