How To Remove Space In Excel Before Numbers
The easiest way to get rid of excess spaces is using the standard excel find replace option.
How to remove space in excel before numbers. So value in cell a2 is 1 trim function does not work for removing the space before the 1. We will consider the same data used in example 1. Click insert module to create a new module script copy and paste below code to the script.
Select the data first. Press ctrl h to open the find replace dialog box. Trim a2 where a2 is the cell you want to delete spaces from.
For example if you want to remove spaces from c2 through c30 highlight those cells. Press space bar in the find what field and make sure the replace with field is empty. Press ctrl h and a dialog box appears for find and replace.
Click the box beneath find what. Below in find what box press spacebar and in replace button to leave it a blank and click on replace all. Select the cells containing spaces you will remove press the ctrl h keys to open the find and replace dialog box.
This removes the spaces anywhere from the selected cells. Highlight the range in which you want to remove all spaces. There we need to put a space and replace that with blank nothing kept.
Press alt f11 key to enable microsoft visual basic for applications window. Press ctrl h and type single space in find what. Trying to remove the space in front of the number 1 in cell a2.