How to add a conditional font format using Replace in Microsoft Word

Estimated read time 4 min read

[ad_1]

Complex updates don’t have to be difficult if you use Replace in Microsoft Word.

Microsoft word online app
Image: PixieMe/Adobe Stock

Microsoft Word’s Replace feature is more powerful than you might know. This feature is so flexible that it’s difficult to know everything it can do. Besides replacing content with new content, you can apply formats, styles, specify special characters, wildcards and much more.

When faced with a complex update, you might not turn to Replace first, but you should. For instance, what would you do if you needed to italicize a specific set of characters — whether it occurs at the beginning, the end, in the middle of a string or by itself, but only when the string is uppercase? You might be surprised that Word’s Replace feature can handle each of those requirements.

SEE: Google Workspace vs. Microsoft 365: A side-by-side analysis w/checklist (TechRepublic Premium)

In this tutorial, I’ll show you how to add italics to each occurrence of the string ATM, regardless of where it occurs, but only when it’s uppercase — that’s the condition. Word for the web can’t apply formats, but you can search for the uppercase string and apply the formatting manually. It’s more work and isn’t a great choice in a long document with many occurrences of the search string.

I’m using Microsoft 365 on a Windows 10 64-bit system, but you can use earlier versions of Word. You can download the Microsoft Word demo file for this tutorial.

How to specify the Find What string in Word

Figure A shows a simple document with only a few strings. Each string contains the string, ATM in uppercase, lower case or both.

Figure A

Replace can find each occurrence of ATM and also add a format to it.
Replace can find each occurrence of ATM and also add a format to it.

To open the Replace dialog, press Ctrl + H or click Replace in the Editing group on the Home tab. Word remembers the previous Replace settings, so you should also check for earlier strings and settings when starting a new Replace task.

Before you do anything, make sure the Find What and Replace With controls are empty. Then, click More, if necessary, to display other options. Uncheck all the options and click No Formatting to remove any formatting applied during the previous task to either the Find What or Replace With control.

Once the settings are all clear, as shown in Figure B, do the following to enter the Find What string:

Figure B

Clear all the settings before starting a Find or Replace task.
Clear all the settings before starting a Find or Replace task.
  1. Click inside the Find What control and enter ATM — you must use uppercase letters.
  2. Because we want to find only the uppercase occurrences, click the Match Case option. When you do, Word displays Match Case under the Fine What control (Figure C).

Figure C

Specify the Match Case option for the Find What string.
Specify the Match Case option for the Find What string.

When you run the Replace task, Word will find only the occurrences of ATM that are uppercase. Let’s move on to the Replace With settings.

How to specify the Replace With string in Word

The Find What conditions are set, so let’s add the Replace With conditions. In this case, we don’t want to replace ATM with anything. We only want to apply italics. To specify that you want to replace the string in the Find What control with the same string, do the following:

  1. Click inside the Replace With control and enter ^&, which is code for “replace the find string with itself.”
  2. Click the Format button in the bottom-left corner and choose Font from the resulting dropdown.
  3. In the resulting dialog, click Italics in the Font Style list (Figure D) and click OK. Now you can see Font: Italics under the Replace With control (Figure E).

Figure D 

Choose Italics from the Font properties.
Choose Italics from the Font properties.

Figure E

Word displays Italics under the Replace With control. 
Word displays Italics under the Replace With control.

There are two things going on with the Replace With settings. Word will replace any matches to the Find What string with itself and also apply italics to it.

You’re ready to put the feature to work.

How to apply the Replace settings in Word

You’ve specified all the conditions using either the Find What or Replace With control. At this point, click Replace All to see it at work. Click OK to confirm the change and close the dialog. As you can see in Figure E, Word added italics to five instances of ATM, but not all.

There are three occurrences of atm that Word doesn’t italicize because they’re lowercase and the Find What setting matches the case of the actual entry, which is uppercase. The requirements sounded complex at the beginning, but Replace handled them all.

[ad_2]

Source link

You May Also Like

More From Author