TRIM()function in Excel
Therefore, this formula only removes the redundant leading and trailing spaces of characters in a cell.
When a user imports a set of data from another application, irregular spaces always exist after the last character of cells. Therefore this formula is necessary to remove those spaces. This is of utmost importance, because a string without space such as “IT” and a string with irregular spaces at the end such as “IT “ will not be treated as identical match in spreadsheet. Thus, if you do a lookup or countif function on “IT”, the “IT “ will be neglected, lead to inaccurate outcome.
=TRIM(" DESKTOP ")
The result will be “DESKTOP”.
The text can be a reference to a cell.
keywords: Text, Data