Software

10 cool ways to get more from Word's Find and Replace feature

Find and Replace can accomplish things most users never dreamed of. Here are some of the best ways to put this feature to use.

Find and Replace is one of Word's most powerful and flexible features -- but it's considerably underused. Most people use it to find specific content, but they don't realize it can also run rings around many tedious tasks. Start with these 10 easy-to-implement ways to use advanced Find and Replace settings and see what they inspire for your own day-to-day chores.

1: Replace two spaces with a single space

Some old school users still insert two spaces after a period. If you inadvertently do this, you can quickly replace two spaces with one:

  1. Press [Ctrl]+H to open the Find And Replace dialog box.
  2. Click inside the Find What control, delete any existing contents, and enter two spaces (just two).
  3. Click inside the Replace With control, delete any existing contents, and enter one space.
  4. Click Replace All or use the Replace and Find Next buttons to find (and replace -- or not) each occurrence individually.

These settings will find all occurrences of two spaces, not just those at the end of a sentence. You can refine the search by prefacing both the find and replace strings with a period (or other punctuation mark).

2: Replace multiple spaces with a tab

One of the biggest mistakes novice Word users make is to enter multiple spaces instead of using a tab to position text on the page -- and those spaces can wreck a document! Fortunately, you can replace them with a tab mark by using the {} code, as follows:

  1. Press [Ctrl]+H.
  2. In the Find What control, enter a single space, followed by {2,}.
  3. In the Replace With control, enter ^t, which represents a single tab mark.
  4. Click the More button and check the Use Wildcards option, as shown in Figure A.
  5. Click Replace All.

The {2,} code tells Word to find two or more literal characters; the space character you entered is the literal character.

Figure A

Use a wildcard to find multiple spaces.

3: Insert new text

Replacing existing text with new text is simple. But inserting new text without deleting anything is a bit harder. For instance, let's suppose you want to insert the text ", Inc." to each occurrence of a company name. You can update each individually or you can use the ^& code as follows:

  1. Press [Ctrl]+H.
  2. In the Find What control, enter the name of the company, Harkins and Son.
  3. In the Replace With control, enter ^&, Inc. as shown in Figure B.
  4. Click Replace All.

Figure B

Use the ^& code to retain the find string.

4: Apply a style

Styles provide a great way to apply consistent formatting. Using Find and Replace, you can do so after the fact as well. To apply a style using this feature, do the following:

  1. Press [Ctrl]+H.
  2. In the Find What control, enter the text to which you're applying the format. (You can use literal text, codes, and wildcards.)
  3. Click inside the Replace With control (and delete any contents).
  4. Click the More button and click Format.
  5. Choose Style from the resulting list.
  6. In the Replace Style dialog, select the style you want to apply, as shown in Figure C.
  7. Click OK. Word will display the style under the Replace With control, as shown in Figure D.
  8. Click Replace All.

Figure C

Specify a style instead of a literal replacement string.

Figure D

The style you selected will be displayed under the Replace With control.

5: Replace a style

To change one style to another, you can use the Style pane to select all the text of one style and then select the new style. That technique is quick at around five clicks. You can also use the Find and Replace feature as follows:

  1. Press [Ctrl]+H.
  2. Click the Find What control and click More.
  3. Click Format and choose Style.
  4. Select the style you're replacing and click OK.
  5. Click the Replace With control.
  6. Click Format and choose Style.
  7. Select the replacement style and click OK. Figure E shows the specified Find What and Replace With styles.
  8. Click Replace All.

This technique requires a few more clicks than the selection method, but it's nice to have more than one solution in your toolkit.

Figure E

Select the replacement style and click OK.

6: Delete paragraphs

Now, suppose you want to delete several paragraphs and their only common attribute is their style. Using the Find and Replace feature, you can quickly delete them:

  1. Press [Ctrl]+H.
  2. Click the Find What control and click the More button.
  3. Click Format and choose Style.
  4. Select the style that the paragraphs share and click OK.
  5. Make sure the Replace With control is empty, as shown in Figure F.
  6. Click Replace All.

Figure F

Replace the find text (which is actually a style) with nothing.

7: Use a trick to replace a long text string

The Find What and Replace With controls are limited to 255 characters. When the replace string is longer, copy it to the Clipboard and use the ^c as follows:

  1. Press [Ctrl]+H.
  2. In the Find What control, enter the text or code to find the content you're replacing. Don't forget about wildcards.
  3. In the Replace With control, enter ^c.
  4. Click Replace All.

This technique will replace the find text with the contents of the Clipboard. Unfortunately, the ^c code doesn't work in the Find What control.

8: Transpose data

Using Find and Replace, you can quickly transpose data. For instance, you might need to transpose a list of names in first name last name format into last name, first name format. Here's how to do it:

  1. Select the list.
  2. Press [Ctrl]+H.
  3. In the Find What control, enter (<*>) (<*>) (Note: There's a space between the two wildcard sets).
  4. In the Replace With control, enter \2, \1 (with a space between the two wildcard sets), as shown in Figure G.
  5. Click the More button and check the Use Wildcards option.
  6. Click Replace All.

Figure G

Using wildcards, you can transpose data.

Here's how the wildcard components work:

  • The brackets (<>) denote the beginning and ending of a word or phrase.
  • The * character refers to any characters.
  • The parentheses indicate a pattern.
  • The slash (\) replaces characters and the number after it indicates the position of a bracketed component.

9: Insert special characters

Sometimes, you need to insert special characters into a document. For instance, you might want to insert a nonbreaking space between parts of a company or person's name. If there are only a few instances of the name and the document is short, you can achieve this manually with little trouble. Otherwise, using Find and Replace might be a better choice:

  1. Press [Ctrl]+H.
  2. In the Find What control, enter the find text.
  3. In the Replace With control, enter the same text, but instead of entering spaces by pressing the Spacebar, press [Ctrl]+[Shift]+Spacebar. You can't tell the spaces apart, but they're different.
  4. Click Replace All.

10: Delete formatted text

Similar to #6, which uses styles to delete paragraphs, you can use Find and Replace to delete consistently formatted text. For example, you could use this feature to delete hidden text:

  1. Press [Ctrl]+H.
  2. Click the Find What control and click More.
  3. From the Format drop-down, choose Font.
  4. Check the Hidden option in the Effects section and click OK.
  5. As you can see in Figure H, Word will display the specified format under the Find What control.
  6. Click Replace All.

Figure H

Delete hidden text using these settings.

Most users don't hide text, but you can use this method with any format. You can also enter a format in both the Find What and the Replace With controls to change one format to another.

Other tricks?

Have you found some clever ways to save time using Find and Replace? Share your techniques with fellow TechRepublic members.

About

Susan Sales Harkins is an IT consultant, specializing in desktop solutions. Previously, she was editor in chief for The Cobb Group, the world's largest publisher of technical journals.

33 comments
nicolinito
nicolinito

I am trying to auto-format a text string (single word) in part normal, part italics. It is a brand name that I need to use a lot in the text and I want to avoid manually italicizing the second half of the word each time. Is there a way of setting this up in Word 2010?

eclark
eclark

Is it possible to use Find and Replace to replace a graphi?  We have a document with the same graphic displayed multiple times.  We'd like to use a replace that graphic with a different one. 

shaunycc
shaunycc

Can you find and replace more than one word at a time? For example: Find DR, PROF or SIR and replace with MR?

neeraj.chowdhury
neeraj.chowdhury

Thanks, the list was exhaustive and informative. Was able to know some new tricks. But I have a requirement which I trust  you could address. I have a 200 page document with around 100 instances where a text is delimited by ( and );

I need to convert this delimited text inclusive of delimiters into italics. I tried in find what \(*\); and in replace pressed Ctrl+I but it could not work. Pls suggest the way.

lsherwin
lsherwin

Excellent advise. Do you know if it is possible to replace a string with a cross reference. I tried to replace multiple strings with a copied cross reference and all I got was the text and not the cross reference itself.

loucan
loucan

I have strings called "text-a", "text-b", and so on. I need to duplicate these stings, so that they read: text-a text-a text-b text-b I can use wildcards to find these strings, but I can't use wildcards in the replace field, so that Search = text-* Replace = text-* text-* It seems that the only solution would be a script to search, copy, paste, replace, but I'm hoping for something simpler.

eaglewolf
eaglewolf

Great article, Susan .. thanks! I learned a lot. But I have a question: why did it become the 'standard' to go from two spaces between sentences to just one? I find it *much* easier to read documents when two are used. Do you know what was behind that decision?

etittle
etittle

I especially like the insert and wild card transpose ideas. I use a few of the others all the time but never knew these. I usually had to type partial sentences to replace a word within. Thanks a lot!

Snak
Snak

I visit a lot of machines in a day and a good number of those visits involve printing problems. One thing I find about Word is very useful. Open a new document and type =RAND(x) where x is a number. Word will then generate x paragraphs of text - perfect for testing the printer without opening the Printers & Devices dialogue and at the same time proving to your client that it is working correctly. = RAND(9) generates an A4 page of text.

robert_baron
robert_baron

To accomplish this, I have been using a space followed by ^w in the Find What box. ^w represents white space which is any combination of soft and hard spaces and tabs. I often get documents sent to me with multiple spaces and/or tabs in an attempt to line up tabular data. This method collapses it all to one tab.

KMacNeil
KMacNeil

Thanks, Susan. I thought I knew Word inside out but I learned a few new things here. It's always nice to start the day learning something. :D

Cadej
Cadej

I don't know in what version of Word you did this. I have Word 2010 with Slovenian interface (and Windows 7 also Slovenian). I tried your number “2: Replace multiple spaces with ???”. In ‘my’ Word I needed do write {2;}. In your Word you needed to write comma I needed to write semicolon.

AndreaN140
AndreaN140

Needing to reposition a column of text where the document originator has used the default tabs and just been happy to hit multiple times to get to the one they want - aaargh! Thankyou Find and Replace for making the job of tidying up so much easier! Thanks Susan - I've learned some new useful ones here too.

ian
ian

to my arsenal of tips and tricks. Thanks Susan. I am interested to know if there is a way to find/replace list bullets such as finding a list bullet style and replacing it with another bullet style and finding all lists (irrespective of style) and changing to a single style. I have tried using format > style > list and list bullet, but to no avail. Is there a way to do it? thanks

art_walls
art_walls

You always come up with great tips. I would never have even thought about using a clipboard entry as a Replace with. And transposing a list? Good job!

conseil
conseil

Does this work in Excel as well as Word?

lehnerus2000
lehnerus2000

You highlighted some tricks I hadn't encountered before. :)

alfatrading
alfatrading

use this form: find: <text-*> replace ^& ^& and don't forget to check wilcards checkbox! Fabio

kew_nick
kew_nick

If you use variable width fonts, such as Arial, Helvetica, Times New Roman, etc. then the software works in the space required to separate a punctuation mark and the next letter. Fixed width fonts (such as those used in typewriters) don't give you that luxury, so it is custom to use a double space (end of sentence) or single space (other punctuation) to differentiate. Have a read of "The Mac Is Not A Typewriter" (or the PC version) for more formatting tips.

robo_dev
robo_dev

So when doing a security review of a system, I download the password file or database table with userids and do a spell check in Word or Excel with the custom dictionary. Any userid that shows up as a spelling error is flagged as potentially an exception.

WilsonT
WilsonT

Starting in, I believe Word 2007, =lorem(x,y) will generate x number of paragraphs and y number of sentences of Lorem Ispum text: "Lorem ipsum dolor sit amet, consectetuer adipiscing elit." for example. Note that =lorem(x,y) has to be at the start of a new paragraph. It will not work within or at the end of a paragraph.

bahnjee
bahnjee

=rand(x,y) will insert x paragraphps of y length (in sentences). In other words, =rand(10,6) will insert 10 paragraphs of 6 sentences each.

ssharkins
ssharkins

Always glad to hear alternatives! Thanks for sharing your solution.

ssharkins
ssharkins

Glad you found this one useful!

ssharkins
ssharkins

I used 2010 for the article, but ran it through 2003 as well to check for discrepancies or major differences. My best guess is that international settings are different for this feature -- thanks for sharing your solution!

ssharkins
ssharkins

I think Find & Replace and Spell Check are two of Word's most powerful features! I'm glad you found this information useful!

ssharkins
ssharkins

Well, have you tried #5? Off that top of my head, it should work -- what's happening instead?

ssharkins
ssharkins

I wish the clipboard worked with the Find control -- that's one I've been trying to resolve for a long time and still don't have a good solution for.

ssharkins
ssharkins

Some will, but to the best of my knowledge, Excel doesn't recognize wild cards.

eaglewolf
eaglewolf

Thanks! Sounds like a good read.

dougvetter
dougvetter

Word will mark text generated this way as "Do not check spelling or grammar" so that the generated text does not as get flagged as misspelled. If you use this "Lorem" text to populate a template, any new text users type in place of the generated text will retain the "Do not check spelling" attribute, which can create problems. You can confirm and change this behavior with the "Set Language" button in the "Proofing" Group on the "Review" tab of the ribbon.

WilsonT
WilsonT

Starting in, I believe Word 2007, =rand.old(x,y) will generate x number of paragraphs and y number of sentences of: "The quick brown fox jumps over the lazy dog." Note that =rand.old(x,y) has to be at the start of a new paragraph. It will not work within or at the end of a paragraph. I find this very helpful when teaching a basic Intro to MS Word class and need to show the Find and Replace functions; replacing 'brown' with 'red' for example. It gives the student many simple but identical sentences to practice on.

Editor's Picks