TRIM function

Excel TRIM Function removes extra spaces from text, leaving only single spaces between words and no leading or trailing spaces. It’s useful for cleaning up data in spreadsheets.




textThe text you want to remove extra spaces from.

How to Use

You can use the TRIM function to clean up text in your Excel spreadsheet. Here are some examples:

This formula will return “Extra Spaces” by removing extra spaces between the words.

If you have a cell with text in it (e.g., ” Excel TRIM Function “), you can use TRIM to clean it up. In this case, if the text is in cell A2, the formula will return “Excel TRIM Function” in another cell.

Remember that TRIM only removes extra spaces; it won’t remove single spaces between words. So, “Hello World” will become “Hello World,” and ” Spaces in Between ” will become “Spaces in Between.”


This formula returns “Remove Extra Spaces.”

If cell A1 contains ” Excel TRIM Function “, this formula will return “Excel TRIM Function.”

When there are no extra spaces, the formula doesn’t change the text. It returns “NoSpacesHere.”

Additional Information

The TRIM function is especially handy when dealing with data imported from other sources, as it can help clean up inconsistent spacing in text fields. It only removes extra spaces within the text and doesn’t affect formatting or formatting characters. Keep in mind that it won’t remove non-breaking spaces or other non-printing characters.

Tomasz Decker is an Excel specialist, skilled in data analysis and financial modeling.