Microsoft Excel’s TRIM and CLEAN functions can remove spaces and non-printing characters from source files.
The TRIM function removes all spaces from a text string except for spaces between words. It will remove spaces at the beginning and end of a text string.
The clean function removes all nonprintable characters from a text string. Nonprintable characters include carriage returns and tabs.
You can perform both TRIM and CLEAN with a single formula.
Example: = TRIM(CLEAN(B4)
After the text is cleaned; using TRIM and/or CLEAN, copy the result and use Paste Special > Values to replace the original data with the new values.