![](https://codky.com/wp-content/uploads/2024/11/13388-1024x576.png)
The TRIM function in Excel is used to remove extra spaces from text, leaving only single spaces between words and no spaces at the start or end of the text. This can be especially useful for cleaning up data imported from other sources that may contain irregular spacing.
Here’s how you can use the TRIM function in Excel:
- Select the Cell: Click on the cell where you want the result of the TRIM function to be displayed.
- Enter the Formula:
- Type `=TRIM(` to start the function.
- Click on the cell containing the text you want to clean, or manually enter the cell reference.
- Close the parenthesis `)` to complete the formula.
- The complete formula should look like this: `=TRIM(A1)`, where `A1` is the cell reference of the text you want to trim.
- Press Enter: Once you’ve completed the formula, press Enter, and the cleaned text will appear in the selected cell.
Example:
If cell A1 contains the text `” Hello World “`, entering `=TRIM(A1)` in another cell will result in `”Hello World”` with a single space between “Hello” and “World” and no leading or trailing spaces.
Note: The TRIM function only removes spaces; it does not remove non-breaking spaces often used in web data. In such cases, you may need to use additional functions to clean your data fully.