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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting and averaging grades

Status
Not open for further replies.

palgya

Technical User
Sep 3, 2002
34
US
Maybe someone can help me out here. I have a simple
database that imports a class critique, then output the
results in a report. The students can grade 15-17
questions for different criteria on a 1 to 5 scale. I want
to be able to count how many students chose to grade each
question whether it be a 1 or a 4 or whatever. Then
provide a percentage and the average. Would it be done in a query or by writing code. Any suggestions? Thanks in advance.
eg...
1 2 3 4 5 Average

Question 1 # 3 5 8 5.3
% 19 32 50
Question 2 # 1 1 8 3 3 3.2
% 5 5 50 19 19
Question 3 # 2 6 6 2 4.0
% 13 38 38 13
 
While I do not agree with your results, the function is rather trivial - at least if you accept my version of the results.

Code:
Public Function basAvgVar(ParamArray ArayIn() As Variant) As Variant

    'Michael Red    3/2/2002. Row Aggregate Function

    Dim Idx As Long
    Dim MyVal As Single
    Dim MyCnt As Long

    For Idx = 0 To UBound(ArayIn)
        MyVal = MyVal + Nz(ArayIn(Idx))
        MyCnt = MyCnt + Abs(Not IsNull(ArayIn(Idx)))
    Next Idx

    If (MyCnt <> 0) Then
        basAvgVar = MyVal / MyCnt
    End If

End Function
[code]


 MichaelRed
m.red@att.net

There is never time to do it right but there is always time to do it over
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top