The Excel TRIM function is used to remove unwanted spaces from cells. These unwanted spaces are usually generated when importing or copying text data into Excel.
The syntax for the TRIM function is:
=TRIM(text)
Argument | Purpose |
---|---|
Text | The text that you want to change. Usually entered as a cell reference |
The image below shows a list of names imported from a database. Some of the names include unwanted leading or trailing spaces. The TRIM function is used to remove them.