Discussion Locked

Calculations in Work Tables

0 helpful
11 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
How do I enter an "IF" statement in a table? I also need to be able to subtract in a table. In the "IF" statement I will need to compare two cells and if one is larger than the other, I will need to enter a "0". If it is the other way around, I will need to subtract the two cells. I cannot have negative numbers.

11 replies

by chainsawz

The 'IF' statement for an Excel table is:=IF(G4-H4>0,G4-H4,0). This statement subtracts the two cells, and replaces any negative numbers with a zero.

by cthapp

Thanks for your prompt reply. However, I can do this particular calculation in Excel. I need to be able to complete the calculation in a Word table. Do you have any suggestions?

by cthapp

I have tried to use the same format as for Excel. However, I get a Syntax error each time. I do know that you have to "name" the cells in word some way in order to make it work. I am using Word 2000. Any additional help?

by peyison

The formula you want looks like:

=if(a1-a2<0,0,a1-a2)

If you have a table one column wide, with three rows, this would go in the third row. In Word, you have column letters and row numbers like Excel, you just have to count for yourself to figure out what they are.

To put a formula in a table:

Choose Table -> Formula

Type in the formula, including the = sign.

You can right click on the field and select "Toggle Field Codes" to switch back and forth from the formula and the result. Also, if you change the numbers in cells A1 or A2, you have to right click on the field and select Update Field to recalc.

Hope this helps.

by donq

Peyison's suggestion is correct however if you build your recordset in a query you can enter an immediate if statement in the "Field:" area as well.

Field: =Iif(a1-a2<0,0,a1-a2) As a3

This way you just let the query do all the data management.

by mike buzz

When I need to do calculations in Word, I use Excel, either:

Use Excel then paste the Excel table into Word, using Edit, Paste Special, Link
Or
Use the Word toolbar button to insert a blank Excel worksheet into Word and do your calculations in it.

In both cases, you get the same result, but in the first case you have a saved Excel spreadsheet that you can open independently.

I would recommend giving it a go and see how it works.
I hope this is useful.

Mike Buzzard

This discussion is closed to new replies.