Removing excess spaces and nonprinting characters

Excel 2016 2013 2010 2007 2003
Data imported into an Excel spreadsheet often contains extra spaces or strange (often unprintable) characters. There are two handy functions, TRIM and CLEAN, to cleanup such data:
Examples with spaces nad nonprinting characters in Excel 365

Excel offers two functions to help whip your data: TRIM and CLEAN.

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

To remove all extra spaces and nonprinting characters, use these two functions:

TRIM and CLEAN text example

= TRIM (CLEAN (<data>))

TRIM and CLEAN functions in Excel 365
TRIM and CLEAN functions 2 in Excel 365

See also this tip in French: Suppression des espaces excédentaires et des caractères non imprimables.

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