How to Remove a Space before Numbers in Excel (3 Easy Ways)

The sample dataset contains 5 Product Names and Product Codes,where the product codes contain extra spaces before the numbers.

How to Remove Space in Excel Before Numbers Dataset


Method 1 – Using the TRIM Function to Remove Space Before Numbers in Excel

 

  • Select cell D5 and enter the following formula.

=TRIM(C5)

Remove Space Before Number Using TRIM Function in Excel

  • Press Enter and utilize the AutoFill tool to fill the entire column.

Read More: How to Remove Tab Space from Excel


Method 2 – Inserting Excel SUBSTITUTE Function to Delete Space Before Numbers

 

  • Select cell D5 and insert the following formula.

=SUBSTITUTE(C5," ","")

Remove Space Before Number Using SUBSTITUTE Function in Excel

  • Press Enter and utilize the AutoFill tool to fill the entire column.


Method 3 – Find and Replace Option to Remove Space Before Numbers

 

  • Select the data where you want to remove space before numbers.

Utilize Find and Replace Option to Remove Space in Excel Before Numbers

NOTE: Here, I have copied the Product Codes into the Correct Code column for better representation.
  • Press Ctrl + H on your keyboard to open the Find and Replace option.
  • In the Find What option, enter a Space.
  • In the Replace With box, make sure there is no space or extraneous characters.
  • Click on Replace All.

  • The codes are returned as below.

Read More: How to Remove Space after Number in Excel


Things to Remember

  • You have to create an extra column in order to get results for methods 1 and 2.
  • You can not only remove the spaces before numbers but also remove spaces between and after numbers using these methods.
  • You need to copy the data into another column if you want to see the changes side-by-side for method 3.
  • You can apply the Find and Replace option to remove spaces for multiple rows and columns at a time. To do so, do not select any particular column and follow the rest of the steps.

Download Practice Workbook

You can download the workbook used for the demonstration from the download link below.

 


Related Articles

<< Go Back To Remove Space in Excel | Data Cleaning in Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
A.N.M. Mohaimen Shanto
A.N.M. Mohaimen Shanto

A.N.M. Mohaimen Shanto, a B.Sc. in Computer Science and Engineering from Daffodil International University, boasts two years of experience as a Project Manager at Exceldemy. He authored 90+ articles and led teams as a Team Leader, meticulously reviewing over a thousand articles. Currently, he focuses on enhancing article quality. His passion lies in Excel VBA, Data Science, and SEO, where he enjoys simplifying complex ideas to facilitate learning and growth. His journey mirrors Exceldemy's dedication to excellence and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo