TRIM()

Syntax. TRIM(text)

Definition. This function deletes the spaces in the text that are not used as delimiters between words.

Arguments

  • text (required). The text containing the leading and trailing spaces you want to delete.

Background. You can use the TRIM() function for text imported from other applications that might contain unnecessary spaces. Redundant spaces at the beginning or end of text can be unhelpful, for example, for a mail merge or when searching for a string in a list.

If the string does not contain leading or trailing spaces, the result is the input string.

Assume that after you import a set of data, you notice that it contains trailing spaces. You need to remove these spaces to further process the data. You cannot use the Replace ...

Get Microsoft® Excel® 2010 Formulas & Functions Inside Out now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.