How to use the TRIM Function?

a drone shot of art works in a farm fields
  • Applies to: Excel for Microsoft 365, Excel for Microsoft 365 for Mac, Excel for the web, Excel 2019, Excel 2016, Excel 2019 for Mac, Excel 2013, Excel 2010, Excel 2007, Excel 2016 for Mac, Excel for Mac 2011, Excel Starter 2010.

In this post, we will explore how to use the TRIM function in Excel, including a summary of it, its syntax, and also an example that you can try at home.

A picture of scissors to represent the TRIM Function.
Image by Clker-Free-Vector-Images from Pixabay.

Summary of the TRIM Function

Essentially, it cuts every space from a block a text with the exception of single spaces that reside between words. I find that it is useful to use TRIM on any text that you have imported or copied from another application as their spacing may have become distorted.

Important Point: The TRIM function was created to trim the 7-bit ASCII space character (value 32) from text. Within the Unicode character set, there is an extra space which is known as the nonbreaking space character that has a decimal value of 160. This character is frequently used in Web pages as the HTML for,  . Independently, the TRIM function seldom erases this nonbreaking space character. Refer to “Top ten ways to clean your data” to clearly see how to trim both spaces from text.

A footpath surrounded by trimmed trees and bushes - symbolises TRIM Function.
Image by Quinn Kampschroer from Pixabay.

Syntax of the TRIM Function


The syntax of the TRIM function contains the relevant arguments:

  • Text – Required. The particular text in which you prefer to have spaces deleted.

TRIM Function Example

Copy the sample data from the displayed table, and paste it into cell A1 of a brand new Excel worksheet. In order to get formulas to present results, choose them, press F2, and then press Enter to top it all off. If at any time you find that some of your data is partially hidden, then you can extend the column widths to completely see your data.

=TRIM(” First Quarter Earnings “)Erases leading and trailing spaces from the text within the formula (First Quarter Earnings).First Quarter Earnings

Similar Topics to Explore

TEXT Function

How to use LEFT, LEFTB functions

How do the RIGHT and RIGHTB Functions work?

Other Links

Excel Tutorial

Leave a Reply

%d bloggers like this: