0

I want to calculate the average of a column or rows of project #1, project #2, etc.... and Adding a new column with the grade of the students ....like the picture..

Im new using visual basic. Thanks in advance. =D


[img]http://i41.tinypic.com/5z1xi.png[/img]

2
Contributors
1
Reply
2
Views
5 Years
Discussion Span
Last Post by Oxiegen
0

In order to calculate the average of a column in MS Access, you need to use the AVG function.

SELECT [Student ID], [First Name], [Last Name], and so on, AVG([Project#1]) AS avg1, AVG([Project#2]) AS avg2, AVG([Project#3]) AS avg3 FROM <table>

This will calculate the average of ALL rows, unless you also add a WHERE clause, in which you restrict which rows to calculate.

However, if you wish to have an average for each separate row then the query will be different.

SELECT [Student ID], [First Name], [Last Name], and so on, ((NZ([Project#1],0) + NZ([Project#2],0) + NZ([Project#3],0)) / 3) AS Average FROM <table>

The NZ function will test if the field contains NULL, and return a value of 0 if it does.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.