Please Note: This article is written for users of the following Microsoft Word versions: 2007, 2010, and 2013. If you are using an earlier version (Word 2003 or earlier), this tip may not work for you. For a version of this tip written specifically for earlier versions of Word, click here: Quicker Multiple Replace Operations.

Quicker Multiple Replace Operations

by Allen Wyatt
(last updated May 31, 2014)

12

It is not unusual to use the Replace function multiple times to replace the same information. For instance, you may have a document that contains quite a few tabs. You can use the Replace function to replace two tabs with a single tab. In this way, you can get rid of the extra tabs. However, if your document contains many, many extra tabs, you can replace 8, 20, or 50 tabs with a single tab.

When you are specifying the number of tabs to replace, it is best to use a multiple of two. For instance, in the Find What box you would enter 4, 8, 16, or 32 tabs, and in the Replace With box you would enter a single tab. Continue selecting the Replace All button until you are informed the requested characters could not be found.

Next, divide the number of characters in the Find What box by two. Thus, if you previously searched for 16 tabs, you would now search for 8. You will only have to click on the Replace All button once then. (Word could not find two groups of 8 in a row—if it did, it would have been replaced by the previous search for 16.) On the next iteration, use only 4, and finally 2 tabs. Basically, you have replaced all the extra tabs in around 4 or 5 operations. This is the fastest possible way to do the iterative search and replace.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (8800) applies to Microsoft Word 2007, 2010, and 2013. You can find a version of this tip for the older menu interface of Word here: Quicker Multiple Replace Operations.

Author Bio

Allen Wyatt

With more than 50 non-fiction books and numerous magazine articles to his credit, Allen Wyatt is an internationally recognized author. He  is president of Sharon Parq Associates, a computer and publishing services company. ...

MORE FROM ALLEN

Jumping to the Start or End of a Document

When creating macros, it is often necessary to move the insertion point around the document so that text can be processed in ...

Discover More

Static Sizes for Comment Boxes

Adding comments to your worksheet can be helpful in documenting what the worksheet contains. If you want to make sure that ...

Discover More

Removing Fingernail Ridges

If you are trying to get the look of glamorous or sophisticated natural nails, you may be foiled in your attempts by ...

Discover More

Comprehensive VBA Guide Visual Basic for Applications (VBA) is the language used for writing macros in all Office programs. This complete guide shows both professionals and novices how to master VBA in order to customize the entire Office suite for their needs. Check out Mastering VBA for Office 2010 today!

More WordTips (ribbon)

Find and Replace in a Column or Row

Need to search for information in a table? Word allows you to easily limit your search to an entire column or row, as ...

Discover More

Searching for Multi-Byte Hex Codes

Need to find a character for which you only know the hex code? There are a few ways you can search for the information, as ...

Discover More

Searching for ASCII and ANSI Characters

Need to get down to the "character level" when searching for information in a document. Word allows you to search for any ...

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is 9 - 2?

2017-10-03 06:10:17

V.S.Rawat

long winded process
in find replace window
1. tick mark "use wild card"
2. put A{2, } in find box
3. put A in replace box
click replace.

it will replace all two or more numbers of AA, AAA, AAA with a single A in one go
You can change A with any letter or digit or puncuation or control character you wish to replace.

and it should work alike in old and new word.


2015-06-02 19:53:00

remus

Ok,
I can't figure this out:

I have 400 pages of this type of text:
ART. X.XXX
Title of Article
Content Content Content Content...

Where X.XXX is a number such as "1.169".

I would like to make it into:
bold: (ART. X.XXX Title of Article )
Content Content Content etc

so far, I've managed to use wild cards etc to either change all ART. ?.??? into bold, or to replace all ^p^p with ^p...which did little to what I want to achieve.

I would need something that finds each and every ART. X.XXX ^P + all text on the following line

and replaces is with ART. X.XXX + The text on the following line, only on the same line as ART. and in bold.

any clues ?


2014-11-25 22:34:40

Stephen McBride

I find this tip works. However the "," needs to be replaced by whatever you use as the separation character ";" in my case.
Also better to use "Number of occurrences" from the special list.
Has anyone a macro (as I am new at this) that replaces all double tabs, double spaces, paragraph and then spaces with singles.
Then it places all .?! with double space following it.
I often need it to clean up documents typed by others.


2014-06-03 07:06:58

Bryan

"Let's say that we don't know of Ken's superior method... "


2014-06-03 03:55:16

Ken Endacott

If you want to get some idea of how powerful wildcards can be, have a look at the examples in the document file FindReplaceData.docx that is in the package that can be downloaded from www.editordie.com.au/editorkae

The document also contains a primer in the appendix on how to use wildcards.


2014-06-03 03:42:49

Ken Endacott

Bryan

With the wildcards that I have given, you only need to click Replace All once. It will find any number of consecutive tabs and replace them by a single tab. The wild cards {2,} mean find two or more consecutive occurrences. If it were {1,} then it would find one or more which would still work as it would replace a single tab with a single tab.

As you can see it it very much faster than Allen's.


2014-06-02 08:02:39

Bryan

(Sorry about the last comment, I keep getting blocked and unblocked and I didn't want to type out my comment only to have it eaten)

Let's say that we don't know of Ken's superior method... it seems to me that replacing repeated groups of 2 tabs would be better than picking some high number of tabs and reducing it. This method has many benefits over Allen's:

* You can just keep pressing "Replace All" until you have 0 replacements.

* You don't have to worry that you didn't pick a high enough number of tabs to start.

* You don't have to change the number of tabs in between each run.

* While you may, depending on the exact distribution of tabs, have to do more replacements with the "low number" method, you won't have any "wasted" replacements. In Allen's example above starting at 16, if you only had, say, one doubled tab, the 16, 8, and 4 replacements would have no effect.


2014-05-31 16:48:06

Ken Endacott

Pam
Yes, you can use ^t instead of ^9 Also, if you are replacing spaces you can use an actual space character, but ^32 is more visible.

LMcIntyre
It looks like you haven't ticked Use wildcards in the drop down menu under the More button. Alternatively there might be a space character in the Find box that can happen when you cut and paste and there is a space on the beginning or end of the string that you are pasting.


2014-05-31 11:14:39

LMcIntyre

Ken's suggestion doesn't seem to work. I get the report that 0 replacements have been made. I cut and pasted his Find box contents, tried it without the brackets, without the comma, using ^t instead of ^9 ... and I always get the report that Word has finished and 0 replacements have been made. My document (which I created with several successive tabs) is unchanged.


2014-05-31 11:07:55

LMcIntyre

Ken's suggestion doesn't seem to work. I get the report that 0 replacements have been made. I cut and pasted his Find box contents, tried it without the brackets, without the comma, using ^t instead of ^9 ... and I always get the report that Word has finished and 0 replacements have been made. My document (which I created with several successive tabs) is unchanged.


2014-05-31 09:45:57

Pam Caswell

Conveniently, ^t, the regular search code for a tab works in wildcard searches--so we don't have to remember ^9.

But ^p, the regular search code for a paragraph mark, still does not. For that, we have to use ^013.


2014-05-31 04:43:50

Ken Endacott

There is a much quicker way to replace multiple tabs with a single tab by using wildcards. In the Find box enter:
[^9]{2,}
In the Replace box put:
^9
Make sure that Use wildcards is ticked (click More >> if you can't see it).
Click Replace All.

Explanation: ^9 is the ASCII code for the Tab character. {2,} means for two or more occurrences of the preceding character.

You can use the same technique to replace multiple spaces with a single space. Instead of ^9 put ^32


This Site

Got a version of Word that uses the ribbon interface (Word 2007 or later)? This site is for you! If you use an earlier version of Word, visit our WordTips site focusing on the menu interface.

Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.