Top 5 Methods to Filter Data with Spaces in Excel
- Using Trim Function
- Using Delimited in Text to Columns
- Using Fixed width in Text to Columns
- Using Find & Replace Option
- Using Substitute Function
Let us discuss each of the methods in detail, along with an example.
#1 – How to Remove Space from the text in Excel Using Trim Function?
We have the following data with us,
Cells in column A have texts which have spaces between them, and we will remove the spaces from them in column B.
- In B1 Type =Trim.
As explained in the text, the Trim function removes all spaces from a text string except for single spaces between words.
- Select the A1 cell.
- Click Enter, and excel automatically remove the extra spaces.
- Drag and Copy the formula to cell B5.
Trim Function removed the extra spaces except for the space between the texts itself.
#2 – How to Remove Space Using Delimited in Text To Columns?
Text to columns in excel also can remove spaces from a cell. Consider the following data,
Where trim function did not remove the spaces between the texts but with text to columns, we can remove the extra spaces between the texts and numbers in excel also.
4.9 (1,353 ratings) 35+ Courses | 120+ Hours | Full Lifetime Access | Certificate of Completion
- Select Column A then, go to Data Tab, click on Text to Columns.
- Select Delimited.
- Click on Next Space as a delimiter, then Click on Finish.
Excel separated the texts from their spaces and placed them into the next column.
#3 – How to Remove Space in Excel Using Fixed Width in Text to Columns Option?
We can also use fixed width in a text to columns option to remove extra spaces from text and numbers in excel. However, our data needs to be in an exact number of characters before the space so that only spaces can be removed. Consider the following data.
We have some random text with random numbers with spaces separating them. We need to remove the spaces and have the numbers in another column.
- Select Column A, then, in Data Tab, Select Text to columns.
- Select Fixed width, then Click on next.
However, your cursor where the spaces are then, Click on Finish.
Now we have separated our data from the spaces using fixed width in the text to columns.
#4 – How to Remove Space Using Find & Replace Option?
Find and replace option also can be used to remove spaces from text and numbers in excel cell. We will consider the same data used in example #1.
- Press CTRL + H, and a dialog box appears to find and replace.
- Below in find what box press spacebar and in replace button to leave it a blank and click on replace all.
- Excel gives us a prompt that all the spaces are removed. Click ok to see the result.
- Each and every space in the cells have been removed.
#5 – How to Remove Space in Excel Using Substitute Function?
We can also use the substitute function in excel to remove all the spaces in a cell. Let us consider the same data in Example 1 again.
- In Cell B1, type =substitute and go to the Formulas tab. Click on Insert Function Option in excel to open the function dialog box.
- The text we want is from cell A1, so in text, select A1.
- We want to remove extra spaces, so in the Old Text box, type “, “which means space.
- In the new text type “, which means no spaces then, Click on Ok.
- Drag the formula to cell B5.
With the Substitute function, we replaced spaces in the cells.
Explanation of Removing Spaces in Excel
When we import data or copy and paste the data in excel from an external source, we also might end up getting extra spaces apart from our important Data.
Also, by having extra spaces, data can look disorderly and can be difficult to use.
To overcome this challenge, we remove extra spaces from our data cell so that it can be more presentable and readable.
Things to Remember
There are few points to remember while removing spaces in excel.
- We need to think about which method to use in certain cases.
- Using text to column options will separate the data in another column.
- Removing spaces using find and replace in excel and substitute function can put up all the strings together.
This has been a guide to Removing Spaces in Excel Cell. Here we discuss how to remove spaces from text and numbers in excel using the top 5 methods (Trim, Delimited, Fixed Width, Find and Replace and Substitute) along with practical examples and a downloadable excel template. You may learn more about excel from the following articles –