# Thread: OR calculation getting an error message in mail merge

1. ## OR calculation getting an error message in mail merge

I have an OR calculation in a mail merge and keep getting the "A field calculation error has occured in record (every page in the final doc)". This is frustrating because it works fine once I click OK to all of the errors.

This is my desired calculation:

{IF { = OR({MyField}=1,"")}"Happy text", "Sad text"}

I have some records where {MyField} = 1, and others where {MyField} is NULL. In either case I want those letters to have the same text.

Any ideas what's causing the errors? Thanks!

2. Try:
{IF{={MERGEFIELD MyField} \# 0} = {MERGEFIELD MyField} "Happy text" "Sad text"}

3. I'll give another example. The best option really seems to be using the OR function, but every time I try I get a calculation error. This is what I would like:

{IF { = OR({MyField}=36, 210, 30, 1140)}"Happy text", "Sad text"}

I simplified it, for instead of "Happy text" I actually have several large paragraphs. The workaround was to just make 4 separate IF statements for each of the criteria. It feels clunky, especially when that is what the OR function was designed for. I guess the question is, can OR ever work in a Word mail merge?

4. Yes, the OR function will work, but can only test two logical numeric expressions at a time, and can’t directly test text strings at all. The correct syntax would be:
{IF{=OR({MyField}=0,{MyField}=1)}> 0 "Happy text" "Sad text"}

You could, of course, nest them, but there is an alternative that handles text comparisons as well:
{IF{={IF{MyField}= 36 1 0}+{IF{MyField}= 210 1 0} +{IF{MyField}= 30 1 0}+{IF{MyField}= 1140 1 0}}> 0 "Happy text" "Sad text"}

5. ## The Following User Says Thank You to macropod For This Useful Post:

Beeblebrox (2013-11-08)

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•