Excel TRIM Function and Formula with Examples

How to Use the TRIM Function and Formula in Excel

In this tutorial, you'll learn how to use the TRIM function and formula in ExcelTRIM is a function to remove all spaces from a given text except for single spaces between words. TRIM() removes leading spaces, trailing spaces, and all blank spaces between words.

TRIM Syntax

=TRIM(text)

Arguments

Text: The text from which you want to remove spaces

Remarks

  • Text is required.
  • TRIM() removes all spaces from text except for single spaces between words.

Excel TRIM Function Examples

Example 1: Remove Leading Spaces

The following is an example of removing leading spaces from the string:

=TRIM(" This example illustrates how to leading spaces from the text using the TRIM function.")

TRIM() returns the following result:

This example illustrates how to leading spaces from the text using the TRIM function.

Example 2: Remove Trailing Spaces

The following is an example of removing trailing spaces from the string:

=TRIM("This example illustrates how to trailing spaces from the text using the TRIM function. ")

TRIM() returns the following result:

This example illustrates how to trailing spaces from the text using the TRIM function.

Example 3: Remove all Spaces except for Single Space between Words

The following example removes all blank space from the string except for single space between words:

=TRIM(" Where can I find the basic Excel tutorial courses? I want to learn how to use Microsoft Excel. This tutorial is best for those who are new to Microsoft Excel. ")

TRIM() returns the following result:

Where can I find the basic Excel tutorial courses? I want to learn how to use Microsoft Excel. This tutorial is best for those who are new to Microsoft Excel.

As you can see, there are no more unnecessary spaces (leading, trailing, and between words spaces all removed).

In this tutorial, you've learned how to use the TRIM function and function in Excel. TRIM() is a function used to remove all unnecessary spaces, including trailing spaces, leading spaces, and blank space between words. However, it doesn't remove single spaces between words.


See also:
Excel ROUNDUP Function with Examples
Excel MIN Function with Examples
Excel COUNTA Function – Count Non-Blank Cells in Excel
Excel COUNTBLANK Function – Count Blank Cells in Excel
Excel SUMIFS Function – Multiple Criteria

Leave a Comment