TRIM Function in Excel
Beginner
Removes all spaces from text except for single spaces between words.
Syntax
=TRIM(text)Example
Use Case
Clean up imported data with extra spaces.
Common Errors to Avoid
- Only removes ASCII space (char 32), not non-breaking spaces (char 160)
- Doesn't remove other whitespace characters like tabs or line breaks
- Doesn't modify the original cell - creates a new value
Pro Tips
Always use TRIM when importing external data to prevent matching errors. Combine with CLEAN to remove non-printable characters. Use SUBSTITUTE for non-breaking spaces: =TRIM(SUBSTITUTE(A1,CHAR(160)," ")).
Need help with this formula?
Our AI Formula Generator can write this for you instantly.
Try AI Formula Generator →