How can we help you?

The TRIM function removes all extra spaces from the string, leaving only single spaces between words.

This function can be useful for cleaning data before analysis or processing.

 

Syntax

TRIM(string)

Argument

Description

Permitted values

string

String from which spaces need to be removed

Text string or reference to a cell containing text

 

Example of use

Removing extra spaces from a string

=TRIM(" Text with extra spaces ")

This formula will remove all extra spaces and return “Text with extra spaces”.

Cleaning up data from a cell

=TRIM(A1)

If cell A1 contains “ Example text with spaces ”, the function will return “Example text with spaces”.

Using in combination with other functions

=PROPER(TRIM(B2))

This formula first removes extra spaces from the text in cell B2, then capitalizes the first letter of each word.

 

Notes

This function is often used in combination with other text functions to pre-clean data.

The function does not affect single spaces between words.

Was this helpful?
Yes
No
Previous
TEXT
Next
UNICODE