TRIM function

This is an Excel function that removes leading and trailing spaces from text within a cell or string. The function will not remove single spaces between any words. The function is often used when dealing with data from another application where extra spaces may have been added to the end.

ArgumentDescription
TextThe cell reference or text string in quotes.
Syntax ExampleWhat Happens
=TRIM(A2)This would remove all leading, trailing, and extra spaces between the words.
=TRIM(” The answer to the universe is 42 “)This would remove all leading, trailing, and extra spaces between the words. It would convert multiple spaces between words into a single space.
Illustrated example of Excel TRIM function.
TRIM function removed extra spaces between words and at end.