Excel Function: TRIM
The Excel function TRIM allows you to remove unnecessary spaces at the beginning and end of a string as well as excess spaces within the string.
Usage:
=TRIM(text)
Example of use
The goal here is to remove all unnecessary spaces from the data contained in column A.
To do this, enter into cell B2:
=TRIM(A2)
Then drag down: