Avatar of Mawallace
Mawallace
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Using the IF condition in mal merge

I have a merge field.

I want this to print a sentence if the numerical value of a merge field is positive,.

If negative I want another sentence to be added.

How can this be done?

I have been playing with the IF command - but to no success
Microsoft Word

Avatar of undefined
Last Comment
GrahamSkan

8/22/2022 - Mon
GrahamSkan

If this is a tristate situation, i.e. no sentence if the value is zero, it would be simpler to use two IF tests:

{IF {MERGEFIELD Myfield} > 0 "Positive sentence."}{ IF {MERGEFIELD Myfield} < 0 "Negative sentence."}
GrahamSkan

If you want zero to be included with the positives:
{ IF {MERGEFIELD Myfield} < 0 "Negative sentence." "Positive sentence."}

If you get any complex field representations posted here, you might like to use the macro in this article to convert to actual fields after you have pasted the text on to your document:

https://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Word/A_7236-Macro-code-to-convert-text-to-fields-in-Microsoft-Word.html
Mawallace

ASKER
This is what is in the document! I thought - but it returns the value >0

I think it is the way I entered the mergefeld

Can you give me some advice- document below 2nd line (I used "p" or "n")
a34mqub9.doc
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
GrahamSkan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question