View Single Post
  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Cindy M -WordMVP- Cindy M  -WordMVP- is offline
external usenet poster
 
Posts: 370
Default IF statement problem !Syntax Error, !

Hi Josh,

Thank you for the reply! I'm using MS Word XP. These are form fields
in my document. They are set to number with dollar formats; each form
field has a bookmark name list below and set to calculate on exit. The
calculation will be just a field. The idea is we call the patient on
the phone pre-register them for their hospital visit and give them an
estimated quote for services based on the patient's insurance
information. We find out how much the patient owes on their
deductible, what percentage the insurance company will pay and what the
patient out of pocket expense is.

OK, then what you need to do in the "IF" is turn each of these formfield (bookmark) names
into a REF field. Select each name (double-click should work) the press Ctrl+F9. The
result should look something like:
{ txtEC1 }

Actually, Word might even work with it, just like that. But sometimes not, so it's safer
to edit the result:
{ REF txtEC1 }

Next, you don't use parentheses in IF fields to group the test/true/false; Word IF fields
use "quotes". And an mathematical equation must also be in a field. So, very roughly:
{ IF { = {Ref txtEC1}+{REF txtEc2} } { = { REF OPNet }- { REF OPMet } } "true here"
"false here" }

A long complicated formula is a PITA to work with in Word :-) If this were mail merge,
I'd suggest using Excel or Access for the data and doing the calculations in an
additional column. In this case, unless macro security is a problem, I'd probably be
tempted to put the calculation in a macro and just dump in the result...

For example, you have 300 dollars left on your deductible and 80%
coverage and a 2000 dollar out of pocket. Say you have some blood work
for $120 dollars; your estimated cost is $120. If you had an MRI the
estimated hospital cost would be $1200, you would pay $300 and the
insurance company would pay 80% leaving you with $300 plus 20% = $480.
If you needed a pacemaker it alone would cost $120,000, instead of
paying $23,940 for the pacemaker you would just pay $2000 because you
do not pay more then your out of pocket expense.

There would be some slight changes depending on our insurance company
plan. Sorry, if I confused anyone.


Cindy M -WordMVP- wrote:
Hi Jlawson,

I created a IF, THEN, ELSE field in word that is based on certain
fields that the user will fill in.

What are these fields, more exactly? Are they form fields in the document? Mail
merge fields? Something else?

With very few exceptions, you can't type a field's name into another field (the IF
field, here). Word won't recognize it as a field and doesn't know where the
ifnormation is coming from. The names must also be in fields. But the kind of field
you can use depends very much on where the original information is coming from...

and as long as we're playing q&a: Which version of word are you using?

OPNet = $5,000
OPMet = $2,000

DedNet = $1,000
DedMet = $100

NetPer = 80%

txtEC1 = $100
txtEC2 = $2500
etc...

This is what I have but I feel I'm missing something simple in the
formula...

!Syntax Error, !


{=IF((txtEC1+txtEC2+txtEC3+txtEC4+txtEC5+txtEC6+tx tEC7)(OPNet-OPMet),(OPNet-OPMet)
,{

IF((txtEC1+txtEC2+txtEC3+txtEC4+txtEC5+txtEC6+txtE C7)(DedNet-DedMet),((txtEC1+txtE
C2+txtEC3+

txtEC4+txtEC5+txtEC6+txtEC7)-(DedNet-DedMet))-(((txtEC1+txtEC2+txtEC3+txtEC4+txtEC5
+txtEC6+txtEC7)-(DedNet-DedMet))*NetPer)+(DedNet-DedMet),(txtEC1+txtEC2+txtEC3+txtE
C4+txtEC5+txtEC6+txtEC7)
}) }



Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply in the
newsgroup and not by e-mail :-)