Contacts

How to remove extra spaces in a Word table. Remove extra spaces in Word. How to automatically remove extra spaces in Word

In this article, you will learn 2 quick ways to remove extra spaces between words or all spaces from Excel cells. You can use the function TRIM(TRIM) or tool Find & Replace(Find and Replace) to clean up the contents of cells in Excel.

When you paste data from an external source into an Excel sheet (plain text, numbers, etc.), you may end up with extra spaces along with important data. These can be leading and trailing spaces, multiple spaces between words, or thousands separators in numbers.

Consequently, the table looks a little untidy and becomes difficult to use. It would seem that a simple task can become difficult. For example, find a buyer named John Doe(no extra spaces between parts of the name), while in the table it is stored as “ John Doe“. Or numbers that cannot be summed up, and again extra spaces are to blame.

From this article you will learn how to clear data from extra spaces:

Remove all extra spaces between words, cut off leading and trailing spaces

Suppose we have a table with two columns. In column Name the first cell contains the name John Doe, written correctly, i.e. without extra spaces. All other cells contain an entry option with extra spaces between the first and last names, as well as at the beginning and end (leading and trailing spaces). In the second column, with the title Length, shows the number of characters in each name.

Use the TRIM function to remove extra spaces

There is a function in Excel TRIM(TRIM), which is used to remove extra spaces from text. Below you will find step-by-step instructions for working with this tool:

Ready! We removed all extra spaces with the function TRIM(TRIM SPACES). Unfortunately, this method takes a lot of time, especially when the table is quite large.

Comment: If after applying the formula you still see extra spaces, most likely the text contains non-breaking spaces. How to remove them, you can learn from this example.

Use the Find and Replace tool to remove extra spaces between words

This option requires less work, but allows you to remove only extra spaces between words. Leading and trailing spaces will also be trimmed to 1, but not completely removed.


Remove all spaces between numbers

Suppose you have a table with numbers in which groups of digits (thousands, millions, billions) are separated by spaces. In this case, Excel treats numbers as text and no mathematical operation can be performed.

The easiest way to get rid of extra spaces is to use the standard Excel tool - Find & Replace(Find and replace).


Remove all spaces using the formula

You may find it useful to use a formula to remove all spaces. To do this, you can create an auxiliary column and enter the following formula:

SUBSTITUTE(A1," ","")
=SUBSTITUTE(A1;" ";"")

Here A1 is the first cell in a column containing numbers or words, in which all spaces must be removed.

Inexperienced users of the Word program often put extra spaces in documents, for example, to indent at the beginning of a paragraph or to abbreviate "g." not separated by year/city. This greatly interferes with further editing of the text and affects the overall impression, especially when it comes to official papers.

A big mistake in this situation is to remove spaces manually. Even if you have a small text, it will take a lot of time to remove all unnecessary indents from it, which can be easily saved using automated methods. Today we will look at the simplest method that will allow you to deal with the problem in 100% of cases.

We note right away that we will consider everything using the example of Word 2016, but the same principle is also relevant for earlier versions, for example, 2010 or 2007.

So, if you already have the desired document open, then we can start.

Step 1: Open the Replace Tool

In the "Home" section we find the "Editing" block (the farthest right), where we select the "Replace" function. A small window should open with two empty fields.

In our opinion, this is one of Verd's most convenient functions, allowing you to quickly replace any fragments throughout the text in just a few clicks.

Tip: if extra spaces occur only at the beginning or end of lines, just select all the text and align the content to the center, and then to the left. You will see how all unnecessary indents have disappeared.

Step 2. Set replacement parameters

We press the "More" button. There, check the box next to "Wildcards".


Pay attention to the fact that in the column "Direction" it is indicated "Everywhere"

We put the cursor in the upper empty line opposite "Find". Press the spacebar, then enter the combination {2;} . This means that all spaces greater than 2 will be found in your document.

Click "Replace All".


We are waiting for the automatic replacement of characters to be performed

Once the process is complete, the program will report how many substitutions have been made. Just click "OK" and get back to editing your text.

If the search was not launched from the first page of the document, the program will prompt you to replace from the very beginning of the text. Agree to be sure that there are no extra indents anywhere.

You can also use the "Replace" tool in a slightly different format: alternately removing two, three, four, etc. spaces. But, as you understand, it will be longer than if you immediately enter a formula that allows you to remove all indents in places where there are more than two.

However, this method can be relevant if you know the exact number of extra spaces in the text - for example, there are 3 of them everywhere. Then in the "Replace" function box, enter three spaces in the top line and one in the bottom.

By the way, the same function helps to remove the same error in the entire document or remove other unnecessary characters, so we recommend that you remember it and use it in future work.

conclusions

And if you want to learn more life hacks about the Word program, write about it in the comments.

If, due to the specifics of your work, you often receive Word documents prepared by someone else, then you probably met in the texts, in addition to spelling errors, problems of a different kind - extra spaces between words or before punctuation marks. Deleting them manually is tedious and time consuming.

But you can make your life much easier if you create two macros that, on their own and in the blink of an eye, will save the document from this misfortune.

Macros are not original and are based on the advice of the authors of the book "Microsoft Word: Comfortable work with macros".

To get started, open some document that you intend to check, or create one yourself by deliberately adding extra spaces between words and before punctuation marks in the text. First, we will create a macro that will remove extra spaces between words.

For those readers who know how to work with the built-in Visual Basic editor in Microsoft Word, I'll just give the finished macro code:

Sub DeleteSpace() Selection.WholeStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = " (2;)" .Replacement.Text = " " .Forward = True .Wrap = wdFindAsk .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.MoveRight Unit:=wdCharacter, Count:=1 End Sub

The second macro we created will find and remove all extra spaces before punctuation marks. Repeat steps 1 through 6 inclusive. Name the macro as DeleteSpacePunctuationMark.

Next steps:

  1. Enter in the field Find first a space, and then enter the following expression:

    {1;}([.,:;\!\?])

    This expression literally means that one or more consecutive spaces that precede any punctuation character listed in square brackets will be searched.

  2. Go to the field Replaced by and type \1 (here one means the ordinal number of the expression enclosed in parentheses).
  3. Click the button Replace All.
  4. Close the dialog box when you have finished searching and replacing. Find and Replace. Deselect text by pressing the arrow key on your keyboard.
  5. Click on the square button in the control panel to stop recording.

For VB connoisseurs - the code to insert into the VisualBasic editor:

Sub DelSpacePunktMark() Selection.WholeStory Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = " (1;)([.,:;\!\?])" .Replacement.Text = " \1" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll Selection.MoveLeft Unit :=wdCharacter, Count:=1 End Sub

So you get rid of the routine of manual actions, which, alas, are inevitable when editing any Word documents, especially when looking for extra spaces in the text.

Remove extra spaces. Another lesson on text formatting in Word. You will spend only a couple of minutes studying it, and you will win many hours and nerves. It is better to spend this time on something useful and interesting. If you often have to work with texts in Word, then you simply need to know the most necessary techniques for quickly editing and formatting text. Otherwise, your work may become not only hated, but also unfeasible. But you can work with pleasure, getting satisfaction from the work done. Imagine that you need to edit the text on 500 pages in a couple of hours. Represented? Is the desire gone yet? And for some, this is not just a job, but also an income. So, so that this income does not become a nightmare, it is enough just to know the basic settings and commands of a text editor. It's not that hard to remember them.

You can simply make a small cheat sheet for yourself and refer to it if necessary.

I will describe using the Word 2010 text editor as an example, but the same can be applied in Word 2007.

Often in the process of creating an article for a site, I write quickly everything in a row, until I was interrupted by a “brilliant” idea, and then I edit the text in all possible ways. So sometimes I put so many gaps ... As long as I hold the spacebar, so many of these gaps will be molded. But then I just do this procedure, and everything falls into place. How to do it?

There are two ways to remove extra spaces: manually (if the text is small), and automatically. I prefer to do things quickly. Actually, for this, the developers of the Word text editor are trying to make everything fast and convenient.

Another thing is that often their efforts are in vain, due to the fact that people simply have no time to study reference manuals. And it makes no sense to study something that you may never need. But if you are reading this article, then you really need it.

Then let's get started.

How to automatically remove extra spacesin Word

Open the document that we need to edit.

Go to the menu home at the very end (on the right). There is a block called Editing. Mouse click on the link Replace.

A small window will open Find and Replace. Go to tab Replace.

Press the button below More.

Check the box next to the entry Wildcards. There should be no more checkboxes anywhere. We set the direction Everywhere.

If we need to set one space in the entire text, then in the line Find put the cursor and press the key on the keyboard Space. After that we write {2;}

This figure indicates that if there are two or more spaces in the text, then they must be removed.

In line Replaced by, again put the cursor and press the key on the keyboard Space.

Now press the key Replace All. After the work done, a window with a report will appear.



Liked the article? Share it