Excel functions / Text
TRIM
Removes extra spaces from text, leaving single spaces between words.
Syntax
=TRIM(text)Arguments
text | The text to clean. |
|---|
How it works
Data pasted from other systems often carries invisible spaces at the start or end. They make lookups fail and duplicates hard to spot. TRIM removes them, and turns any run of spaces between words into one.
It is usually the first step of cleaning text, combined with other functions: =PROPER(TRIM(A2)).
Example
| A | B | C | |
|---|---|---|---|
| 1 | Company | ||
| 2 | acme ltd | acme ltd | |
| 3 |
Result: acme ltd. The leading, trailing and doubled spaces are gone.
Tips
- If a VLOOKUP returns #N/A for a value you can see, extra spaces are the usual cause.
Practise TRIM
Try it yourself in a real spreadsheet, with instant feedback on every answer.