Excel Productivity Guide
Useful Excel Tips | Keyboard Shortcuts | VBA Codes
Download this Free E-Book to take your excel skills to a whole next level using some smart Excel tactics.
10000+ Copies Already Downloaded
A clean data is our birthright. But sometimes, we are not able to access it.
Sometimes, we are not able to use our data as the way we want to use it.
And, the one biggest reason which makes our data unable to use is unwanted spaces in a cell. So, if you want to use it you have to delete these extra spaces.
When you think about this, most of the time when you get data from ERP systems or you have some formulas which not written properly.
Even, every time you work on your date you have to verify if there are any extra spaces. These extra spaces can give you pain in future so you need to remove them in the very beginning of your work.
Today in this post, you will learn 4 Different Methods for Deleting Spaces in Excel.
And, you will also learn that why all these methods are unique and usable in different situations.
Table of Content
So let’s get started to explore these methods. And, please download this sample file to follow along.
It happens sometimes that you get trailing and leading spaces in your data and it looks very nasty. But we have a very simple & easy method to pull out this garbage from our data.
And, we need only one function to deal with it. TRIM FUNCTION.
TRIM can remove all unwanted spaces from a text string except the spaces between two words.
In above example, we have used TRIM Function to remove all the unwanted trailing and leading spaces from the cell.
We have total 70 characters in the cell in which we have unwanted spaces & when I have used TRIM characters count is decreased to 41. That means it has deleted the 29 spaces from the cell.
Now, there is also an another possibility that you’ll get a line break in your text string.
In this situation, you need to use CLEAN function with TRIM. The clean function can remove all non-printing character which includes a line break as well.
In above example, we have used a formula by combining trim and clean to remove line break.
First of all, the clean function will remove all non-printing characters from a text string and then trim function will remove all unwanted spaces from text string other than space between two words.
Here we have an another type of issue with these white spaces.
It happens sometimes that we want to remove all type of spaces from a cell. But clean and trim both are not able to remove all type of spaces.
For example, if you have a non-breaking space in a cell, you will not able to deal with it using both of these functions. And for this problem, you need to combine CLEAN and TRIM with SUBSTITUTE function.
Let me show you an example.
In below example, we have a list of mobile numbers in a worksheet. And, these numbers are surrounded by some unwanted white spaces. we only need 10 digit mobile number from it.
But, by using both trim and clean we are not able to do that. That’s why we have to use substitute function.
Substitute function can help you to find a specific character or a set of characters from a text string & replace with some other characters or a single character.
Wait a minute I have another option to solve the above-mentioned problem. And, you don’t have to use a formula for that. You can use find & replace option to replace white spaces from a cell.
Here are the steps.
Important Note: Use this method only in that situation when you are confirmed to remove all type of spaces from selected cells.
Extra spaces are always irritating. But now, you have 4 different methods to remove them. You can choose any of these methods which you think is perfect for you.
I hope this will help you to play well with your data.
Now tell me one thing. Do you know any other problem related to unwanted spaces in excel which I am now covering here? Or, you have any other way to deal with these problems.
Please share with me in the comment box. I would love to hear from you.