To deal with these unwanted space problems, we have a built-in function called TRIM in Excel, which can remove all the unwanted spaces in the Excel cells. The syntax is very simple. We need to select the required cell to be trimmed. The TRIM function removes all the spaces except the s...
Method A: Remove all extra spaces from strings with the TRIM function (2 steps) Remove extra spaces from strings 1. Select a cell next to the cell you want to remove extra spaces from string, type this formula =TRIM(B2) B2 is the cell you want to remove spaces from, See screenshot:...
TheTRIM function in Excelis used to remove leading and trailing spaces from a text string. It is useful for cleaning up data where extra spaces may have been inadvertently included. For example, if a cell contains the text "Data", the TRIM function will remove the leading and trailing space...
Removing those cells one by one will surely cost a lot of time especially when there are many cells that contain additional spaces. Therefore, you can use the methods below to remove spaces. Method 1: Find and Replace In this method, we will show you to use the “Find and Replace” fea...
1.1 – Using the TRIM Function to Remove All Extra Spaces The TRIM function removes additional spaces from a text value. Steps: In cell D5, enter the following formula and press ENTER: =TRIM(C5) The extra spaces are removed. 1.2 – Combining the TRIM, MID, FIND & LEN Functions to Re...
In this formula, multiple spaces act as the link delimiter. The “TRUE”value of theignore_emptyargument will ignore all the empty values. ThisTEXTJOINfunction will joinC4toC6cell values using the given delimiter. How to Remove Spaces in Excel?
5. Press Enter:After selecting the cell, press the Enter key. The TRIM function will process the text in the chosen cell and remove any leading or trailing spaces. 3. Removing Trailing Spaces with SUBSTITUTE Function in Excel If you're aiming for a customizable way to eliminate trailing spac...
For Each cell In rng cell.Value = WorksheetFunction.Trim(cell.Value) cell.Value = WorksheetFunction.Substitute(cell.Value, " ", "") Next cell End Sub 4.2 运行宏 关闭VBA编辑器,回到Excel工作表,按下Alt + F8打开宏对话框,选择RemoveSpaces宏并点击Run。然后选择需要处理的单元格范围,点击OK。宏将自...
For example, to remove spaces in cell A1, you use this formula: =TRIM(A1) And the following screenshot shows the result: Yep, it's that simple! Please note that the TRIM function was designed to remove only the space character, which has value 32 in the7-bit ASCIIcode system. If in...
How to remove all spaces in Excel In some situations, you may want to remove absolutely all white spaces in a cell, including single spaces between words or numbers. For example, when you have imported a numeric column where spaces are used as thousands separators, which makes it easier to...