Article updated on January 12, 2018

The picture above shows you values that have multiple leading and trailing blanks, sometimes also between words.

The TRIM function deletes all blanks or space characters except single blanks between words in a cell value.

Excel Function Syntax



text The string or cell value you want to delete blanks from.


The TRIM function removes the space character from a cell value, however, there is another space character commonly used in HTML pages that are not removed by this function.

To remove that space character you need to use the SUBSTITUTE function with the TRIM function. Formula in cell C3:


CHAR(160) returns the other space character that TRIM can't delete. The SUBSTITUTE function then replaces the HTML space character with a regular space character.