View Single Post
  #5   Report Post  
Posted to microsoft.public.word.tables
Suzanne S. Barnhill
 
Posts: n/a
Default MS Word table - problem with conditional formula

Well, this was pretty bizarre, but here's the answer:

{ IF B2=X { = PRODUCT (2.9,2} "" }

That is, remove the quotes around "X." The spaces around the first = are
crucial, but none of the other spaces matter, and it works with or without
quotes around the IF field.

In most case spaces make no difference; Word inserts and in some cases
insists on spaces between the field delimiters and the contents; spaces
around operators can be more touchy.

Also, I realize this is probably just a sample/example/test, but if your
actual field were going to be the product of 2.9 and 2, it would make a lot
more sense to just put "5.8" instead of { = PRODUCT (2.9,2) }.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.

"Peterkins via OfficeKB.com" u20492@uwe wrote in message
news:5e648d56f3b52@uwe...
Hi Suzanne

Thanks for your response. If one tries to construct the formula from the
Word menu bar - Table Formula, the Formula dialogue appears and any

formula
constructed appears in the cell with a pair of braces around it. However

if
one pastes the IF function into the formula line it then appears as

"=IF( )"
(without the quotes of course). I have been unable to find any way to

insert
a pair of braces in the formula line. So I have constructed the formula
directly in the table cell using Ctrl + F9 to insert the braces then

keying
in your suggested syntax. The formula was accepted into the cell without

any
error message, but when I selected the cell and updated it with F9 the

cell
remained blank even though there was an X in B3. Your alternative also
performed similarly.

It seems the inclusion of spaces does make a difference. In the following

I
have put asterisks where spaces occur: -

{*IF*B2*=*"X"*{*=*PRODUCT(2.9,2),*}""*} This gives a "no result" i.e. the
cell is blank when updated.

{*IF*B2="X"*{*=*PRODUCT(2.9,2),*}""*} Removing the spaces either side of

the
first "=" causes a X to appear in the cell when it is updated.

Unfortunately I am no further forward in finding what is wrong with the
syntax of my version. Please may I ask you if you have actually tried to

get
this working on your system; I would be very interested to know.



Suzanne S. Barnhill wrote:
I think you're trying to use Excel syntax in Word. Word's syntax would

be:

{ IF B3 = "X" { = PRODUCT (2.9,2) } "" }

or just

{ IF B3 = "X" { = 2.9 * 2 } "" }


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...ables/200604/1