Microsoft KB Archive/242177

From BetaArchive Wiki
Knowledge Base


Works: How to Calculate a Running Total or Average in a Database

Article ID: 242177

Article Last Modified on 1/25/2007



APPLIES TO

  • Microsoft Works 2000 Standard Edition
  • Microsoft Works 6.0
  • Microsoft Works Suite 2000
  • Microsoft Works Suite 2001



This article was previously published under Q242177

SUMMARY

This article describes how to calculate a running total or a running average in a Microsoft Works database.

A running total or running average displays the sum or average of all of the values in a specific field up to the current record. In a Works database, you can use a self-referencing formula to calculate a running total or a running average.

MORE INFORMATION

To create a sample database that calculates running totals and averages:

  1. In a new Works database, create the following four new fields, and then click Done:
    • Values
    • Number
    • Total
    • Average
  2. On the View menu, click List.
  3. In the first record:
    1. In the Values field, type 20.
    2. In the Number field, type 1.
    3. In the Total field, type the number located in Values.
    4. In the Average field, type the following formula:

      =Total/Number

  4. In the second record:
    1. In the Values field, type 40.
    2. In the Number field, type the following formula:

      =Number+IF(Values,1,0)

    3. In the Total field, type the following formula:

      =Total+Values

  5. Type the following values in the Values field in the next four records:
    • 0
    • 60
    • 80
    • 100

As you type new values in the Values field, the values in the Number, Total, and Average fields are calculated automatically. The following table shows the results.

NOTE: Blank values in the Value field are not counted in the Average field.

Values Number Total Average
20 1 20 20
40 2 60 30
0 2 60 30
60 3 120 40
80 4 200 50
100 5 300 60



Additional query words: w_works works2k w2001 recursive accumulative cumulative

Keywords: kbfaq kbhowto kbui KB242177