View Single Post
  #2   Report Post  
Cindy M -WordMVP-
 
Posts: n/a
Default

Hi ?B?Qmc=?=,

I would like to test the contents of one table cell, and if it is empty set
the current table function to one text value, else set the current table cell
to a different text value.

I have tried adding the formula to the table cell using Insert|Field, and
then clicking the Formula button and entering: =if(B5="","Value 1", "Value
2"), and get a syntax error.

Can someone please provide an example that would work? Specifically, how do
I specify an empty or space value in the if statement, and then how am I
messing up syntactically?

Firstly, you must use FIELDS in order to perform functions and calculations in
Word. So If() won't work, and you won't be able to work via the Formula button.

Secondly, you can't test for an "empty" cell, because a cell in Word is NEVER
empty. It always holds the end-of-cell marker (combination of a paragraph mark,
plus a range that contains a pointer to the cell formatting and structure
information in the document's binary structure). You can test for a value of 0,
however. If the cell contains nothing, it will return 0.

Start with inserting an IF field, using place holders where you need additional
fields. Alt+F9 to see the field codes in the document. Then you can use
Insert/Field again for any fields you need to nest within the IF field. This
could work, for example:

{ IF { = B5 } = 0 "True value" "False values" }

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
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 :-)