Cleaning Spaces With TRIM
Remove extra spaces from messy text using TRIM.
The Problem With Extra Spaces
Data copied from websites, PDFs, or other systems often arrives with extra spaces. You might see a space before a name, two spaces between words, or trailing spaces you cannot even see.
These invisible spaces break lookups, sorting, and matching. The TRIM function cleans them up so your text behaves predictably.
What TRIM Does
TRIM removes spaces from text, following a simple rule:
- It deletes all spaces from the start and end
- It reduces any run of spaces between words to a single space
So TRIM(" Hello world ") returns the clean Hello world with exactly one space in the middle and none on the edges.
=TRIM(" Hello world ")All lessons in this course
- Extracting Text With LEFT and RIGHT
- Pulling From the Middle With MID
- Measuring Text With LEN
- Cleaning Spaces With TRIM