Removing excess spaces and nonprinting characters

Excel 365 2016 2010 2007 2003
Often, data imported into an Excel worksheet contains excess spaces or strange (often unprintable) characters. There are two handy functions TRIM and CLEAN to cleanup such data.

Excel provides you with two functions to help whip your data into shape: TRIM and CLEAN.

  • TRIM removes all leading and trailing spaces and replaces internal strings of multiple spaces by a single space.
  • CLEAN removes all nonprinting characters from a string. These "garbage" characters often appear when you import certain types of data.

This example uses the TRIM function. The formula returns Fourth Quarter Earnings (with no excess spaces):

TRIM-CLEAN

= TRIM (CLEAN (" Fourth Quarter Earnings "))

If you have any questions or suggestions, please feel free to ask OfficeToolTips team.

We use cookies to personalise content and ads, to provide social media features and to analyse our traffic. We also share information about your use of our site with our social media, advertising and analytics partners who may combine it with other information you’ve provided to them or they’ve collected from your use of their services.

Learn more