Please Note: This article is written for users of the following Microsoft Word versions: 97, 2000, 2002, and 2003. If you are using a later version (Word 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Word, click here: Understanding the COMPARE Field.

Understanding the COMPARE Field

Written by Allen Wyatt (last updated April 2, 2022)
This tip applies to Word 97, 2000, 2002, and 2003


One of the fields that Word makes available for automating your documents is the COMPARE field. Most people don't use this field that much because it can be confusing to do so. The entire purpose of the COMPARE field is to do exactly what it says—compare values. All you need to do is provide the two values (along with the comparison operator), and COMPARE will return either a 1 if the comparison is true or a 0 if it is false.

For example, let's say you wanted to compare the contents of a bookmark to see if it was equal to a specific value. If your bookmark name is MyBook, the following COMPARE field will do the trick:

{ COMPARE { MyBook } = "TestText" )

If the bookmark (MyBook) is equal to TestText, then the COMPARE field returns a value of 1 (True). If it is not, then COMPARE returns a value of 0 (False).

As you might imagine, returning a zero or a one, by itself, may not be that valuable of a feature. Where COMPARE comes in handiest is when you use it as an argument for one of the other comparison fields. For instance, you might use COMPARE in conjunction with the IF field to specify conditional text for your document. When used in this way, the value of COMPARE is limited only by your imagination.

WordTips is your source for cost-effective Microsoft Word training. (Microsoft Word is the most popular word processing software in the world.) This tip (551) applies to Microsoft Word 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Word (Word 2007 and later) here: Understanding the COMPARE Field.

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

Adding a File Path and Filename

If you need to stuff the current workbook's filename and path into a cell or a header or footer, you'll appreciate the ...

Discover More

Large Numbers in the MOD Function

There is a known bug in the MOD function that stops it from working with large numbers and small divisors. This tip ...

Discover More

Understanding the Start Menu

When you want to start using Windows for real, you'll typically need to go through the Start menu to do it. This tip ...

Discover More

The First and Last Word on Word! Bestselling For Dummies author Dan Gookin puts his usual fun and friendly candor back to work to show you how to navigate Word 2013. Spend more time working and less time trying to figure it all out! Check out Word 2013 For Dummies today!

More WordTips (menu)

Standard Text before a Sequence Number

When you use fields to number items within a document, you may want to add some standard text before each field. There ...

Discover More

Sequentially Numbering Elements in Your Document

One of the most powerful and useful fields provided by Word is the SEQ field. This tip describes how you can use the ...

Discover More

Inserting the Subject in Your Document

One of the properties you can specify for a document is a subject. You can then use a field code to insert this subject, ...

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 + 1?

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 menu interface (Word 97, Word 2000, Word 2002, or Word 2003)? This site is for you! If you use a later version of Word, visit our WordTips site focusing on the ribbon 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.