Texteasy

TRIM()

Removes leading, trailing, and repeated spaces in text.

Syntax
fx
=TRIM(text)
Try it
F2
→
Acme Co
Sample data · sales.csv
ABCD
1CompanyRegionQuarterRevenue
2Acme CoWestQ118,400
3Acme CoWestQ222,100
4Acme CoWestQ331,700
5Acme CoWestQ448,200
6GlobexEastQ114,200
7GlobexEastQ219,800
8GlobexEastQ323,400

Common pitfalls

  • Removes ASCII spaces (and runs of them between words) but does NOT remove non-breaking spaces (CHAR(160)) or tab characters. Use CLEAN(SUBSTITUTE(x, CHAR(160), " ")) for stubborn whitespace.
  • Collapses internal runs of spaces to single spaces: that's a feature, not a bug, but it WILL alter content like ASCII art or aligned columns.
Related formulas
SUBSTITUTE()
Replaces existing text with new text in a string. Match by content.
Used by
SUBSTITUTE()
Replaces existing text with new text in a string. Match by content.