ms-wordstatistics

Simple percentage computation inside a table direct in Microsort Word


For one of my customers I need to constantly update a word document with statistics.

The statistics are very simple and are basically just a bunch of several tables with frequency counts and the corresponding percentages.

As it is very error prone and tedious to always compute the percentages I just wanted to know, if Microsoft Word provides a feature for simple computation of percentages by insertion of very basic formulæ.

In the below screenshot the red percentages should be computed automatically, like in Excel.

Example Table


Solution

  • Word has a calculation feature called a "Formula Field", but it lacks many of the features available in Excel.

    At its simplest, you need a formula field like this in your Percentage column in row 2 of the table

    { =B2 \#0,00% }
    

    then in row 3

    { =B3 \#0,00% }
    

    and so on.

    That assumes that "," is the decimal point character in your Windows (or MacOS) locale.

    You don't actually need any of the spaces in there, i.e. you can reduce the last example to

    {=B3\#0,00%}
    

    You can enter this kind of field using the Formula dialog box (fx Formula button in the Table Layout tab, Data group), but it's probably simpler to get used to inserting a pair of the special field braces { } using ctrl-F9 on Desktop Windows Word then typing the other text in between. Field results generally have to be updated manually by selecting the field(s) and pressing F9.

    If you have a lot of rows and/or you may need to resequence them, it would probably be better to use a nested field that calculated the row number, and use the same set of fields in each row, e.g.

    { ={ QUOTE B{ SEQ R } } \#0,00% }
    

    If you prefer, you can reduce that to

    {={QUOTE B{SEQ R}}\#0,00%}
    

    All of the { } have to be the special field brace pairs you insert using ctrl-F9.

    The result of the first { SEQ R } will be 1, whereas in your table you need it to be 2. To achieve that, you can insert an initial

    { SEQ R \h }
    

    somewhere before your percentage field ( the \h option hides the field result) Or you can modify the field coding in row 2 to be

    { ={ QUOTE B{ SEQ R \r 2 } } \#0,00% }
    

    to start the sequence at 2.

    Once you have set up the field coding you need you can select it and create an autotext/autocorrect to make it easier to insert.

    If you need to use a sequence number in more than one column you can either use a different sequence name ( e.g. R1, R2 etc.) for each column or you can re-use the current value using { SEQ R \c }.