Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

average of two numbers

Status
Not open for further replies.

ersatz

Programmer
Oct 29, 2002
114
US
Hi,
I have a column in my access database table and I want to add another column with average of every two numbers, like that:
Field1 field2
A1 “”
A2 (a2+a1)/2
A3 (a3+a2)/2
A4 (a4+a3)/2
An (an+a(n-1))/2
Can everybody help me, please?
Regards,
ersatz
 
I would not advise storing a calculated field in your database. It is better to have your program do the calculations as necessary.

However each situation is unique and you may have good reasons for storing the calculated values. If so just add them as you would any other field.

Just remember that if you change the values of the data fields then the calculated fields will no longer be correct. That is why it is not recommended. Thanks and Good Luck!

zemp
 
Hi Zemp
Thanks for your response.
I never change the data.
I have a program witch take data from a server and I must make some calculus with that like standard deviation, variance, covariance,relative variation, etc.
For example I don't know to calculate the average for every 40 records in my field
(a1+....a40)/40;
(a2+...a41)/40;etc..
Any idea?
Thanks again,
ersatz

Sory for my english
 
look up aggregate function in VBHelp. There are entries for SUM and COUNT as well as AVG Let me know if this helps
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'There are 10 kinds of people in the world: those who understand binary, and those who don't.'
 
I would take johnwm's advice and use the aggregate functions. The help should explain how to use them properly. Thanks and Good Luck!

zemp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top