Syntax

=TRIM(text)

Example

=TRIM(A1)

When to Use It

Use TRIM to clean up messy data pasted from another source that often has extra leading, trailing, or doubled-up spaces.