Use Microsoft Word's advanced Find-and-Replace feature to make quick work of complex problems.
Microsoft Word's Find-and-Replace feature is powerful and can do a lot. Most users have no idea just how much they can do with this feature. For instance, TechRepubllic reader Joseph wants to find instances of a specific word with a specific font color, so he can remove the color, bold the text, add a colon, and place the text on a line of its own. It's not too much for Word, but the results will depend on document settings—so you might get close, really close, and still need a bit of manual updating.
Disclosure: TechRepublic may earn a commission from some of the products featured on this page. TechRepublic and the author were not compensated for this independent review.
LEARN MORE: Office 365 Consumer pricing and features
I'm using (desktop) Office 365 on a Windows 10 64-bit system, but these settings will work in older versions. There's no downloadable demonstration file; simply use the RAND() function to add a bit of text to a blank document. The online version of Microsoft Word doesn't support the advanced Replace features.
SEE: The end of Windows 7: Exit strategies and protection tips (free PDF) (TechRepublic)
How to do an advanced search in Microsoft Word
Advancing beyond a simple text search isn't difficult; it's a matter of knowing what you can change and what you can't. There are three things you should know before you begin:
You can find and replace almost anything with the help of advanced features and wildcards. (Wildcards aren't required for this solution, but you should know that they're available.)
Sometimes, you can get close, but you might need to clean things up a bit.
If you don't like the result, use Ctrl+Z to undo the Replace and try again.
Let's suppose you want to reformat a single word or phrase, but you don't want to change the text. In addition, you want to add a character or word and you want to push text that follows the search string to the next line.
Let's change every instance of the word video that's in red to the body text color (whatever that might be), bold it, add a colon character (:), and make sure it's on a line of its own, regardless of where it falls in a sentence. We can accomplish all of that with one Find-and-Replace task. (Figure A has four instances of the word video, but only three of them are red.)
How to identify the color
You can specify all kinds of formats, including colors, as a Find and a Replace setting. The problem with colors is that there are so many, and they can be difficult to identify. If it's one of the standard colors, you're in luck and you can skip this part. If you need help identifying a font color, do the following:
Highlight some text that's formatted using the color in question.
Click the Font Color dropdown (in the Font group on the Home tab).
Click More Colors.
Click the Custom tab in the resulting dialog.
Write down the numbers in the Red, Green, and Blue setting controls. Figure A shows the values for the standard red. Be sure to note which is which—it matters.
How to use Find What
Once you know the exact color in question, you can identify it in either the Find What or Replace With controls. We'll only use it in the Find What control, as follows:
Click Replace in the Editing group on the Home tab.
In the resulting dialog, clear any existing settings in either control.
Clear More and then click No Formatting. This feature remembers previous settings and you need to start with a clean slate.
In the Find What control, enter video.
Click the Format dropdown and choose Font.
From the Font Color dropdown, choose the color you're searching for. If you don't know the exact thumbnail to choose, click More Colors.
In the resulting dialog, click the Custom tab and enter the Red, Green, and Blue values (Figure B) that you noted in the last section.
Click OK twice.
How to use Replace With
We have the right settings for the search term; now let's specify the Replace setting. We want to reset the color to the body font color, add bold and a semicolon, and place the search term on a line of its own. Let's do that now:
Click inside the Replace with control and enter ^p^&:^p. I'll explain them in a bit.
Click the Format dropdown and choose Font.
From the Font Color dropdown, choose Automatic.
In the Font Style list, click Bold.
Click OK. Figure C shows all the settings.
Click Replace All and then click the confirmation to return to the document shown in Figure D.
^p inserts a paragraph mark.
^& retains the search text, case, and formatting.
The Replace With codes position a paragraph mark before and after the original search text (in this case, the word video), while retaining the current case and any direct formatting.
What we can't do
In this case, the results might still need a bit of work. For instance, you might want to delete the extra space at the beginning of the line that was pushed down a line or you might want to replace the first character with an upper-case character. In addition, it's difficult to control line spacing for every document.
If the line spacing isn't what you'd like because of the spacing in newer versions, select the entire document (Ctrl+A) and check the Don't Add Space Between Paragraphs of the Same Style option in the Paragraph dialog (click the dialog launcher in the Paragraph group). Run the Replace task and then reset the spacing option.
It's a good reminder that planning a document's structure beforehand is more efficient than after the fact, but we all know that doesn't always happen. Learning more about the advanced features will help you find efficient ways to solve complex problems using this feature. However, the results might not be perfect every time. When that happens, you might try a second Find-and-Replace task. Do you have a solution for updating the case and removing that extra character?
Send me your Microsoft Office questions
I answer readers' questions when I can, but there's no guarantee. Don't send files unless requested; initial requests for help that arrive with attached files will be deleted unread. You can send screenshots of your data to help clarify your question. When contacting me, be as specific as possible. For example, "Please troubleshoot my workbook and fix what's wrong" probably won't get a response, but "Can you tell me why this formula isn't returning the expected results?" might. Please mention the app and version that you're using. I'm not reimbursed by TechRepublic for my time or expertise when helping readers, nor do I ask for a fee from readers I help. You can contact me at email@example.com.
- What's in Windows 10 19H2 for enterprises? (TechRepublic)
- Windows 10: A cheat sheet (TechRepublic)
- 20 pro tips to make Windows 10 work the way you want (free PDF) (TechRepublic)
- Windows 10 security: A guide for business leaders (TechRepublic Premium)
- Microsoft delivers first Windows 10 Fast Ring build from its new development branch (ZDNet)
- 6 simple security changes all Windows 10 users need to make (CNET)
- Get more must-read Microsoft tips and news (TechRepublic on Flipboard)