Remove Spaces from a String

This post will guide you how to remove extra spaces between words or text string from the specified range of cells in excel. How to delete all spaces from excel cells. For example, when you paste data from an external source to your current worksheet, and you must want to delete all the extra spaces, such as: leading spaces or trailing spaces, or you just want to remote all spaces between words.

Remove All Spaces from a String

If you want to remove all blanks or spaces in range of cells B1:B4, you can create a formula using SUBSTITUTE function to achieve the result. Like this:

=SUBSTITUTE(B1," ", "")

Type this formula in the Cell C1, and press Enter key, then drag the AutoFill Handle over the cells that you want to apply this formula. You will see that all spaces have been removed.

remove spaces1

Remove All Spaces from a String

If you want to remove extra spaces from text string in cells, you just need to use the TRIM function to remove extra leading space or trailing space or other extra spaces. Type the following formula in cell C1, and press enter key, then drag the AutoFill Handle over the cells that you want to remove extra spaces.

=TRIM(B1)

remove spaces2


Related Functions

  • Excel Substitute function
    The Excel SUBSTITUTE function replaces a new text string for an old text string in a text string.The syntax of the SUBSTITUTE function is as below:= SUBSTITUTE  (text, old_text, new_text,[instance_num])….
  • Excel TRIM function
    The Excel TRIM function removes all spaces from text string except for single spaces between words.  You can use the TRIM function to remove extra spaces between words in a string.The syntax of the TRIM function is as below:= TRIM (text)….

Related Formulas

  • Remove Leading and Trailing Spaces
    To remove leading and trailing spaces from text string in Cells, you can use the TRIM function to remove extra spaces.If you want to quickly remove leading and trailing spaces, you can write an  Excel VBA macro code…
Related Posts

How to Remove All Extra Spaces and Keep Only One Between Words in Excel
How to Remove All Extra Spaces and Keep Only One Between Words 7

Sometimes when copying something from other type files to excel, there might be two or more spaces display between words. Extra spaces between words are frequently to be seen in excel, and this behavior is very annoying. If we want ...

How to Remove Middle Name from Full Name in Excel
Remove Middle Name from Full Name 6

When we get a list of full names, we can remove the middle name for short in some cases. As the middle names are different among the full name list so we cannot replace them by space directly in excel. ...

How to Count Comma Separated Value in One Cell in Excel
count value separated by comma2

This post will guide you how to count values in a single cell separated by commas with a formula in Excel. How do I count comma separated values in one cell in Excel 2013/2016. Is it possible to have a ...

How to Remove the First/Last Word from Text string in Cell
remove first last word in cell2

This post will guide you how to remove the first and the last word from a text string in cells in Excel. How do I use a formula to remove first and last word of a text string in Excel. ...

Extract Email Address from Text
exctract email address from text3

This post will guide you how to extract email address from a text string in Excel. How do I use a formula to extract email address in Excel. How to extract email address from text string with VBA Macro in ...

Remove Trailing Spaces from Cells in Excel
remove trailing spaces5

This post will guide you how to remove leading and trailing spaces in cells in Excel. How do I remove leading or trailing spaces in a range of cells with a formula in Excel. How to remove trailing spaces from ...

Convert Scientific Notation to Text or a Number in Excel
convert scientific notation to text7

This post will guide you how to convert scientific notation to text or a number in Excel. How do I convert excel scientific to text with a formula in Excel. Convert Scientific Notation to Text or a Number in Excel ...

Reverse Concatenate Formula in Excel
reverse concatenate function7

This post will guide youw how to reverse the concatenate function in Excel. how do I split the text string into the muliptle cells with a formula in Excel. How to split text data of a cell to multiple cells ...

Remove Leading and Trailing Spaces
remove leading and trailing spaces112

In this tutorial you will learn that how to remove leading or trailing spaces from a text string in a cell in Excel. This post will guide you how to delete leading or trailing spaces of all cells in a ...

How to Count Spaces before the Text String
count spaces before text2

This post will guide you how to count the number of spaces before the text string in a cell in Excel. How to count the leading spaces before the text string in one cell with formula in excel. How do ...

Sidebar