how to return a calculation using an if function

R

rllewis

I want an IF function formula to return a calculation rather than a
text string in Word. Is this possible? If so, what's the format. For
example, IF a1 > 0, a2*e2, "".
 
P

Peter Jamieson

If a1,a2,e2 are bookmarks,

{ IF { REF a1 } > 0 "{ ={ REF a2}*{ REF e2 }" "" }

All the {} need to be the special "field code braces, not the ones you can
type on the keyboard.

If a1, a2 and e2 are cell addresses in a table and the field is also in that
table, try

{ IF { =A1 } > 0 "{ =A2*E2 }" "" }

If the field is outside the table contianing the cells you want to
reference, you have to qualify them by putting a bookmark (let's call it
tablex) somewhere in the table (or selecting the table and bookmarking it)
then using somthing more like

{ IF { =( sum(tablex A1) } > 0 "{ =sum(tablex A2)*sum(tablex E2) }" "" }

(The "sum()" is only there because there doesn't appear to be a way to
reference the value directly, e.g.

{ =tablex A1 } and { =(tablex A1) } do not work.

There's more in Word help if you need it.

NB, if you are using table references such as A1, A2 etc., I would try to
avoid using bookmark names with the same format, e.g. A1, B10 etc.

Peter Jamieson
 
R

rllewis

Peter Jamieson wrote:> If a1, a2 and e2 are cell addresses in a table
and the field is also in that
table, try

{ IF { =A1 } > 0 "{ =A2*E2 }" "" }

Yes, Peter, I am using a cell in a table which is referencing other
cells in the table. Buy this formula didn't work. the cell didn't even
recognize it as a formula.
 
P

Peter Jamieson

Command-F9 gives you a pair of them. Option-F9 lets you toggle between
"Field codes" and "field results" view.

Peter Jamieson
 
P

Peter Jamieson

You are using the special {} ?

Peter Jamieson
Peter Jamieson wrote:> If a1, a2 and e2 are cell addresses in a table
and the field is also in that

Yes, Peter, I am using a cell in a table which is referencing other
cells in the table. Buy this formula didn't work. the cell didn't even
recognize it as a formula.
 

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