Search code examples
ms-wordformulaword-2010fieldcodes

MS Word table formula for value of cell above


Is there a way in MS Word to get in table the value of the cell above for calculation?

I want to calculate the percentage of the sum.

example tabel

I can build the sum with the formular =SUM(ABOVE), but I couldn't find a link to the value of the cell above. XXX in the table should be replace by a formula, something like that:

value_of_cell_above (74.970) * 0,2 => 14.994

Solution

  • Word's cell addressing is quite crude and doesn't have a facility for this.

    In this case, your best bet is probably to use a nested field to assign the result of your =SUM(ABOVE) to a bookmark, then reference the bookmark.

    e.g. in row 3, column 2, put

    { SET theSum { =SUM(ABOVE) } }{ theSum }
    

    in row 4, column 2, put

    { ={ theSum }*0.2 }
    

    All the {} have to be the special field code brace pairs that you can insert using Ctrl + F9 on Windows Word and typically Cmd + F9 or fn + Cmd + F9 on Mac Word.

    There is a case for wrapping up sequences of fields inside a { QUOTE } field to increase the chance that if anyone deletes anything in the cell, they delete the whole calculation and not just part of it. It's sometimes easier to spot problems in that case e.g.

    { QUOTE { SET theSum { =SUM(ABOVE) } }{ theSum } }
    

    Most of the spaces in these field codes can be removed if you prefer a minimalist approach.