Are you frustrated at the prospect of manually removing leading and trailing spaces from data? There is absolutely no need to worry, because by using the Trim function the wasteful and inefficient method of painstakingly removing leading and trailing spaces from data can be eliminated. Assuming you have imported data with leading and trailing spaces into Excel, in this tip we show you how your data can easily be cleaned.Â
Applies To: Excel 2003, 2007, 2010
1.Â Â Â Â Â Â Â Â For this tip, the screen shot below will be used as an example
2.Â Â Â Â Â Â Â Â Select cell C2 and type: =Trim(B2)
3.Â Â Â Â Â Â Â Â Press enter and copy the formula down
The leading spaces have been removed from the data after using a simple Trim function. No need to waste time by manually removing leading spaces.
If you have any suggestions for an Excel Tips & Tricks topic, or you would like help with a particular function, please email firstname.lastname@example.org and yours could be the next Tip of the Week.
Alchemex provides examples of MS Excel procedures for illustration only, without warranty expressed or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. The MS Excel procedures on this web site are provided “as is” cannot be guaranteed that they can be used in all situations