Expressions?

T

TomorrowsMan

Two VERY beginner questions:

When I see the { } parens in the examples of what to use in word form
field expressions, do they need to be in the expression field as well?

Also, what expressions can I use in form field calculations? For
instance, in Excel I would have this formula in a cell:

=IF(A1=0,SUM(A2/5),SUM((A1+A2)/8)))

Is there a way I can use this type of formula in a Word form
calculation field?

Cheers,

TMan
 
D

Doug Robbins - Word MVP

For starters, you must use Ctrl+F9 whenever you want to insert a pair of
field delimiters { }

As far as your expression goes, assuming that the bookmark names assigned
the the formfields in the equivalent of your Excel cells A1 and A2 are Text1
and Text2, the express that you would use in the formfield in which you
wanted to display that result would be

{ FORMTEXT { IF Text1 = 0 { = Text2/2 } { = (Text1 + Text2)/8 }}}

Note that in a Word IF field, the condition and the true and false results
are separated by a space rather than by a , as in Excel.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
T

TomorrowsMan

Thanks a ton, that must be it -- but I still can't get it to work; I
keep getting syntax errors.

My code, then, would be:

{FORMTEXT { IF Text73 = 0 { = Text73/5 } { = (Text73 + Text75)/8 }}}

Do I just put this exact line in the calculation box? Or in the
formula box from the Insert > Field... menu?

Sorry, I'm still stumped on exactly where I put this in.......
 
T

TomorrowsMan

Ah hah - I think it worked...but it's revealed anothe rproblem I
thought I'd solved; the subtotal fields before it (Text73 and Text75)
are not updating automatically....back to the drawing board. Thanks
for this -- I think it'll work once I get the subtotals to calculate
correctly!
 
D

Doug Robbins - Word MVP

You are going to run into problems if you use as an input to a formfield
calculation, the data from another formffield that is itself the result of a
calculation.

You will probably be better off to use a macro on exit from the appropriate
formfields that uses the .Result property of the formffields to obtain the
values from them and set the value in the formfield where you want the
result to be displayed.

--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 

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