Remove Leading Spaces in Excel

Last Updated :

21 Aug, 2024

Blog Author :

N/A

Edited by :

Ashish Kumar Srivastav

Reviewed by :

Dheeraj Vaidya

Table Of Contents

arrow

How to Remove Leading Spaces in Excel Cell?

In Excel, unwanted space characters often take considerable time to clean and make the data perfect. One of the biggest problems with these unwanted leading spaces in Excel cells is that we cannot simply recognize a space in it. It adds to the misery.

#1 - Remove Unwanted Leading Spaces in Excel Cell Using TRIM Function

Let us start.

  1. Yes, you could argue why we don’t replace space with anything. But the problem is it will also replace all the necessary spaces. For example, look at the below sentence in a cell.


    Remove Space Example 1

    In the above sentence, we need one space character after each completed word to make the sentence proper. We have only one extra space after the word “Capital.”

  2. 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.


    Trim Formula

  3. The syntax is very simple. We need to select the required cell to be trimmed. The TRIM function removes all the spaces except the single space after each word. Let us apply the TRIM formula in Excel to remove all kinds of spaces in a cell.


    Remove Space Example 1-1

  4. This TRIM function removed the spaces between “Capital” and “is.”


    Remove Space Example 1-2

#2 - Remove Non-Breaking Leading Spaces in Excel Cell

It is very easy to remove normal leading spaces in the Excel cell. However, the TRIM function goes wrong in the case of non-breaking leading spaces. For example, look at the below image.

Remove Space Example 2

Even after the TRIM function is applied, we do not see the perfect sentence here. It is a problem with non-breaking leading spaces in an Excel cell.

Non-Breaking Leading Spaces in Excel Cell usually comes when we download the data from a web made up of the character CHAR (160). Therefore, we must use TRIM and SUBSTITUTE excel functions in these cases together.

Firstly, open the TRIM function.

Remove Space Example 2-1

Now, apply the SUBSTITUTE function.

Remove Space Example 2-2

We need to select the text now, so select the A4 cell as the reference.

Remove Space Example 2-3

What is the old text we need to remove here? The old text is CHAR (160).

Remove Space Example 2-4

New text to be a substitute is nothing, so mention double quotes (“).

Remove Space Example 2-5

Close the bracket and press the "Enter" key. We will get a proper sentence now.

Remove Space Example 2-6

This way, we can deal with breaking spaces in the Excel cell. If the TRIM function cannot give accurate results, use this technique.

#3 - Remove Double Spaces Using Excel FIND & REPLACE Method

We can remove double spaces in cells using the Excel find and replace method. For example, assume below is the data we have in Excel.

Remove Space Example 3

Here, we have a first name and last name together. After the first name, we have two spaces instead of one space. Instead of the TRIM function, we can use the find and replace method in these cases.

Step 1: Select the required area’s double space to be removed.

Remove Space Example 3-1

Step 2: Now, press "CTRL + H."

Shortcut for Find & Replace

You will see below the "Find and Replace" window.

Remove Space Example 3-2

Step 3: Type two space characters in the "Find what:" box.

Remove Space Example 3-3

Step 4: Now, in the "Replace with:" type only one space character.

Remove Space Example 3-4

Step 5: Now, click on "Replace All."

Remove Space Example 3-5

Step 6: Excel will show you how many replacements it has made.

Remove Space Example 3-6

Step 7: It has removed all the double spaces in the Excel cell and replaced them with a single space. So, we have proper names now.

Remove Space Example 3-7

#4 - Remove All Leading Spaces Using Excel FIND & REPLACE Method

Assume you are working with numbers. You have many spaces between the numbers, as shown in the image below.

Example 4

We have abnormal Excel leading spaces between, before, and after the numbers. In these cases, we need to remove all the spaces. So use the "Find and Replace" method.

  • Step 1: Select the data first.
Example 4-1
  • Step 2: Press "Ctrl + H" and type a single space in the "Find what:" box.
Example 4-2
  • Step 3: Do not insert anything in the "Replace what:" box. Just click on "Replace All."
Example 4-3
  • Step 4: It will remove all the leading spaces in the Excel cell. We have numbers in order now.
Example 4-4

Things to Remember

  • If the FIND and REPLACE method is used to remove leading spaces in an Excel cell, selecting the range and performing the operation is important.
  • If downloading the data from the web and encountering the same space problem, we must use the SUBSTITUTE function to remove CHAR (160) along with the TRIM function.
  • To remove non-printable characters, we must use the CLEAN Excel function.

This article is a guide to Remove Leading Spaces in Excel Cell. Here, we discuss how to remove leading spaces in Excel along with practical examples and a downloadable Excel template. You may learn more about Excel from the following articles: -

  • VBA Hyperlink
  • Remove Watermark in Excel
  • Delete Blank Rows in Excel
  • How to Remove Duplicates in Excel?