### TRIM Function In Excel

##### Associated Files Download Links

In this Article

This Excel Tutorial demonstrates how to use the **Excel TRIM Function** in Excel to remove all extra spaces from text, with formula examples.

## TRIM Function Description:

The TRIM Function Removes all extra spaces from a text string. Retains single spaces in between words.

## Formula Examples:

Example | Formula | Result |
---|---|---|

Remove Leading Spaces | =TRIM(C5) | < |

Remove Extra Spaces | =TRIM(C6) | extra spaces |

Remove Trailing Spaces | =TRIM(C7) | trailing spaces >> |

## Syntax and Arguments:

The Syntax for the TRIM Formula is:

1 |
=TRIM(text) |

### Function Arguments ( Inputs ):

**text** – A string of text.

## Additional Notes

When working with text, it’s always a good idea to use the TRIM Function to clean the text. Extra spaces can cause unwanted errors when working with functions such as VLOOKUP and MATCH.

You can use the EXACT Function to test if two strings of test are equal. Keep in mind, the EXACT, SUBSTITUTE, and FIND functions are case-sensitive, so it’s also a good idea to use the UPPER, LOWER, or PROPER functions to put all the text in a consistent case.

## TRIM Examples in VBA

You can also use the TRIM function in VBA. Type:

`application.worksheetfunction.trim(text)`

For the function arguments (text, etc.), you can either enter them directly into the function, or define variables to use instead.

Return to the List of all Functions in Excel

## How to use the TRIM Function in Excel:

To use the AND Excel Worksheet Function, type the following into a cell:

`=AND(`

After entering it in the cell, notice how the AND formula inputs appear below the cell:

You will need to enter these inputs into the function. The function inputs are covered in more detail in the next section. However, if you ever need more help with the function, after typing “=TRIM(” into a cell, without leaving the cell, use the shortcut **CTRL + A** (**A** for **A**rguments) to open the “Insert Function Dialog Box” for detailed instructions:

For more information about the TRIM Formula visit the

Microsoft Website.