Removing excess spaces and nonprinting characters
Excel
365
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 for Microsoft 365 Examples with spaces nad nonprinting characters in Excel 365](/images/tips/81_365/1.png)
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:
- CLEAN removes all nonprinting characters from a string. These "garbage" characters often appear when you import certain types of data:
To remove all extra spaces and nonprinting characters, use these two functions:
![TRIM and CLEAN text example TRIM and CLEAN text example](/images/tips/81_365/text.png)
= TRIM (CLEAN (<data>))
![TRIM and CLEAN functions in Excel for Microsoft 365 TRIM and CLEAN functions in Excel 365](/images/tips/81_365/4.png)
![TRIM and CLEAN functions 2 in Excel for Microsoft 365 TRIM and CLEAN functions 2 in Excel 365](/images/tips/81_365/5.png)
See also this tip in French: Suppression des espaces excédentaires et des caractères non imprimables.