Excel functions / Text

TRIM

Removes extra spaces from text, leaving single spaces between words.

Syntax=TRIM(text)

Arguments

textThe 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

C2=TRIM(A2)
ABC
1Company
2 acme ltd acme ltd
3

Result: acme ltd. The leading, trailing and doubled spaces are gone.

Tips

Practise TRIM

Try it yourself in a real spreadsheet, with instant feedback on every answer.

Start the exercise

Related