Conditional Style Application

Written by Allen Wyatt (last updated August 30, 2025)
This tip applies to Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365


Will notes that in Excel he can create conditional formats to highlight information that meets defined criteria. He wonders if there is a way in Word to do essentially the same thing, applying paragraph-level formatting based on content contained within the paragraph.

There is no equivalent of conditional formatting within Word; that is strictly an Excel feature. You may, however, find a workaround satisfactory. Since Will mentions styles, I'm going to assume he knows how to create them and apply them. With that in mind, follow these steps:

  1. Define the style you want applied to the paragraph containing the "trigger" content. Make sure the style is defined as a paragraph style. (This is very important.)
  2. Press Ctrl+H. Word displays the Replace tab of the Find and Replace dialog box.
  3. Click the More button, if it is available. Word expands the dialog box.
  4. In the Find What box, enter the "trigger" word or phrase.
  5. In the Replace With box, enter ^&. (That's a caret, Shift+6, followed by an ampersand.)
  6. With the insertion point still in the Replace With box, click Format. Word displays some formatting options.
  7. Click Style. Word displays the Replace Style dialog box.
  8. Select the style you defined in step 1.
  9. Click OK. The style name should appear under the Find What box.
  10. Click Replace All.

What you end up with is every paragraph that contains the "trigger" text will now be formatted with the desired style. If you later remove the "trigger" text from a paragraph, Word won't change the paragraph formatting; you'll need to change it manually. If you later add the "trigger" text to a different paragraph, you'll need to again do the Find and Replace.

If you prefer to use a macro to do the styling, the following will process an entire document quickly:

Sub ConditionalStyles()
    Dim p As Paragraph
    Dim sTrigger As String
    Dim sStyleName As String

    sTrigger = "my trigger text"
    sTrigger = "*" & LCase(sTrigger) & "*"

    sStyleName = "MyStyle"

    For Each p in ActiveDocument.Paragraphs
        If LCase(p.Range.Text) Like sTrigger Then
            p.Style = sStyleName
        End If
    Next p
End Sub

To use the macro, set sTrigger to the "trigger" text and set sStyleName to the name of the style to apply. The style name must be defined within the document. The same usage caveats apply here as I mentioned earlier with the Find and Replace process.

Note:

If you would like to know how to use the macros described on this page (or on any other page on the WordTips sites), I've prepared a special page that includes helpful information. Click here to open that special page in a new browser tab.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (13951) applies to Microsoft Word 2007, 2010, 2013, 2016, 2019, 2021, 2024, and Word in Microsoft 365.

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

Clearing All Tabs in a Document

Need to get rid of all the tab stops in a particular document? It's easy to do when you apply the technique outlined in ...

Discover More

Two-Line Headings in a TOC

If you use the TC field to mark what goes in a TOC, you may wonder why if you mark two lines together with the field they ...

Discover More

Saving AutoText Entries with Each Document

AutoText can be a great way to add consistent, common text to a document. Unfortunately, you cannot save AutoText entries ...

Discover More

Do More in Less Time! An easy-to-understand guide to the more advanced features available in the Microsoft 365 version of Word. Enhance the quality of your documents and boost productivity in any field with this in-depth resource. Complete your Word-related tasks more efficiently as you unlock lesser-known tools and learn to quickly access the features you need. Check out Microsoft 365 Word For Professionals For Dummies today!

More WordTips (ribbon)

Deploying Standard Styles through an Organization

When you are working with Word in an organization (regardless of how many people), standardizing styles and their use can ...

Discover More

Intelligently Starting a New Paragraph

When using styles in a document, you can increase your productivity by letting Word know what paragraph style you expect ...

Discover More

Turning Off Automatic Hyphenation for Parts of a Document

Word can hyphenate documents automatically, if you want it to. But what about those situations where you want most of a ...

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}] (all 7 characters, in the sequence shown) 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 1 + 9?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


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.

Videos
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.