TRIM

Formulas / TRIM
Removes any unnecessary white space from text
TRIM(text)
  • text - the text to remove spaces from

Examples

  • =TRIM(A2) // removes extra spaces from A2

    This example shows how the TRIM function can be used to remove extra spaces from a cell. In this example, the TRIM function is used on cell A2. This will remove any extra spaces from the cell, leaving only the original text.

  • =LEN(A16)-LEN(TRIM(A16)) // returns the number of extra spaces in A16

    This example shows how the LEN and TRIM functions can be used to find the number of extra spaces in a cell. In this example, the LEN function is used on cell A16, and then the LEN function is used on A16 after applying the TRIM function. By subtracting the results, this will return the number of extra spaces in cell A16.

Summary

The TRIM function is a method for cleaning up data in a worksheet. It removes extra spaces from data, including irregular spacing.

  • The Sourcetable TRIM function removes extra spaces in text, including any leading or trailing spaces. It leaves one space between words.
  • The TRIM function can be used with the CLEAN function, which cleans other characters from text.
  • The TRIM function removes the ASCII space character from strings, but does not remove the non-breaking Unicode space character.


Frequently Asked Questions

What does the TRIM function do?
The TRIM function removes spaces from text. It removes spaces at the beginning and end of text and leaves only one space between words.
Does the TRIM function work with text from other applications?
Yes! In fact, the TRIM function is good for removing irregular spacing from text from other applications.
Does the TRIM function remove HTML reserved characters?
No, the TRIM function does not remove HTML reserved characters. It removes only the ASCII space character.
Does the TRIM function remove nonbreaking spaces?
No, the TRIM function does not remove nonbreaking spaces, which frequently appear in web pages.
Sourcetable Logo

Work smarter

Al is here to help. Leverage the latest models to
analyze spreadsheets, enrich data, and create reports.

Drop CSV