Text
TRIM
Definition
TRIM returns text with extra spaces removed from the ends and with inner runs of spaces reduced to one.
Syntax
=TRIM(text)
Arguments
| Argument | Meaning |
|---|---|
text |
The text, or the cell holding it, to tidy. |
Worked example
A street list was pasted with extra spaces. The names are in B2:B4.
| A: Id | B: Street |
|---|---|
| 1 | oak lane |
| 2 | elm road |
| 3 | ash way |
Formula: =TRIM(B2)
Result: oak lane. The extra spaces at each end are gone, and the two spaces between the words become one.
Practice
Cell A2 holds hi there with extra spaces at each end and two spaces between the words. In B2, write a formula that trims those extra spaces.
- In B2, write a TRIM formula for A2.
- B2 should show A2 without extra spaces.
Related functions
After TRIM, LEFT can take a prefix from the tidy text, and LEN reports a shorter count because the extra spaces are gone.
Common mistake
Expecting TRIM to remove a non-breaking space: those characters stay put, so LEN can still look too high after TRIM.