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.
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.
Do More in Less Time! Are you ready to harness the full power of Word 2013 to create professional documents? In this comprehensive guide you'll learn the skills and techniques for efficiently building the documents you need for your professional and your personal life. Check out Word 2013 In Depth today!
Need to add the name of the current month to your document? Word includes a field that can make the addition easy, and it ...
Discover MoreWant to copy a field code and paste it in some other Windows program? This can be trickier than it sounds. Here's the ...
Discover MoreIf you need to control exactly where text will appear on the page or relative to other text, you need to know about the ...
Discover MoreFREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
2024-07-02 20:22:47
Jaime Carrozzi
Can you please explain the difference between 1.) IF Compare Mybook = "test Text" and 2.) If Mybook = "test Text"? If you would be so kind to email that response to jaime.carrozzi@getevolved.com.
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.
Visit the WordTips channel on YouTube
FREE SERVICE: Get tips like this every week in WordTips, a free productivity newsletter. Enter your address and click "Subscribe."
Copyright © 2024 Sharon Parq Associates, Inc.
Comments