Excel Tutorial Topics
- All Excel Shortcuts
- Writing Excel Function
- Excel SUM Function
- Excel COUNT and COUNTA Functions
- Excel Length of Formula (LEN)
- Excel Trim Function
- Excel Right, Left and Mid Functions
- Excel Vlookup
- Creating Drop Down List in Excel
- Creating A Simple Macro and Add-In
- Assigning Macro to Button in Excel
- Installing an Add-In- 2010 / 2007 / 2013
- Creating VBA Form in Excel for Data Entry
Excel Trim Function
Excel Trim function is very useful function that removes extra spaces from data. This formula removes all spaces from data except for single space between words. While validating data on the basis of length of cell, the trim function can give you valid length by removing spaces from beginning, spaces from end and extra spaces between words.
This can be useful for refining raw data received from any external application with irregular spacing.
Syntax And Examples:
Trimming extra spaces from plain text:
Trimming extra spaces from text in a cell:
Result in A3: Excel Bee
We have kept two spaces between “Excel” and “Bee” in A1 cell and the trim function has trimmed extra spaces and gave output with single space left between words.
- Trim function only trim 7-bit ASCII space character (value 32).
- Trim function does not trim line break (7-bit ASCII line break character (value 10).
- If you are unable to trim leading or trailing extra spaces, then you should consider checking ASCII code of the character by using function =CODE( ).
Watch Video Tutorial