Conditional Format Using If

Joined
Mar 5, 2014
Messages
1
Reaction score
0
I have a Word 2010 document which is a mail merge using an Excel spreadsheet. One of the merge fields is HR which relates to a heart rate. In the MailMerge document, which works perfectly the field looks like this (I did use Ctrl and F9 to insert { but in this forum I have had to type the characters):

{MERGEFIELD HR}

When the MailMerge is completed the correct value is displayed.However, I would like to use a conditional format that says if the HR is above 85 then format the font bold and red. To achieve this I found the following (in this example the first MERGEFIELD HR is set to bold and red, the second not bold and black but it does not display in this forum post);

{IF {MERGEFIELD HR} > 85 {MERGEFIELD HR} {MERGEFIELD HR} }

However, no matter how I try to get this to work, all I get is an error below:

Error! Unknown op code for conditional.

I have tried using spaces, removing spaces, adding \*CHARFORMAT but to no avail. The merge field is in a cell of a table in Word, so does this make a difference?
 
Joined
Mar 30, 2014
Messages
6
Reaction score
0
> {IF {MERGEFIELD HR} > 85 {MERGEFIELD HR} {MERGEFIELD HR} }

> However, no matter how I try to get this to work, all I get is an error below:

> Error! Unknown op code for conditional.

> I have tried using spaces, removing spaces, adding \*CHARFORMAT but to no avail. The merge field is in a cell of a table in Word, so does this make a difference?


Did you try putting a space after the greater-than operator (>) and then recalculating?

Right:
{IF {MERGEFIELD HR} > 85 {MERGEFIELD HR} {MERGEFIELD HR} }

Wrong:
{IF {MERGEFIELD HR} >85 {MERGEFIELD HR} {MERGEFIELD HR} }

After putting a space after the greater-than operator, select the expression and press F9 to recalculate it.

Putting the expression inside a cell makes no difference.


PS
If you need to break up the data into more than two bands (e.g. Under 86, 86-95, 96-105, and over 105), post back. I have created a relatively simple method for constructing nested {IF} statements.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top