Formula guide · Excel and Google Sheets · Updated May 13, 2026
Remove Extra Spaces in Excel and Google Sheets
Remove leading, trailing, repeated, and invisible spaces from spreadsheet text.
Quick Answer
Use TRIM for normal extra spaces, CLEAN for non-printing characters, and SUBSTITUTE for non-breaking spaces.
Copyable Formula
=TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," ")))
Syntax
=TRIM(CLEAN(SUBSTITUTE(A2,CHAR(160)," ")))
Excel and Google Sheets
Worked Example
| Raw text | Clean text |
|---|---|
| Acme Corp | Acme Corp |
| North Co | North Co |
| Hidden space | Use SUBSTITUTE |
Result: Returns cleaner text that can be used reliably in lookup and comparison formulas.
Steps
- Start with TRIM to remove leading, trailing, and repeated normal spaces.
- Add CLEAN when pasted data contains invisible characters.
- Use SUBSTITUTE with CHAR(160) when web or PDF data contains non-breaking spaces.
Common Mistakes
- Assuming TRIM removes every hidden character.
- Cleaning only the lookup value but not the lookup column.
- Overwriting original data before verifying the cleaned result.
Excel vs Google Sheets Notes
The core idea works in both Excel and Google Sheets, but separators, function availability, and array behavior can vary by account, locale, and version.
Editorial check: This guide was last updated May 13, 2026. Formula behavior can vary by Excel version, Google Sheets rollout, and spreadsheet locale.