Text function

Google Sheets TRIM function

Removes spaces from the start and end of text, and shrinks repeated spaces inside it to one.

Syntax

=TRIM(text)
textThe text or cell to clean.

Try it

Edit the formula and the result updates instantly. Click a cell to add its reference.

▦ Customer import
fx
Result: jane DOE
ABC
1Name (raw)Order codeCity
2 jane DOE NY-2041-ANew York
3MARK smithCA-1187-BFresno
4ana lopezTX-3302-CAustin
5li weiWA-0459-ASeattle
6 OMAR faroukFL-7720-BTampa
7sara KIMNY-5521-CBuffalo

Examples

These use the sample sheet above.

→ jane DOE

" jane DOE " becomes "jane DOE".

→ 11

The cleaned name is 11 characters.

Tips & common mistakes

Related functions