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

Help with changing code

Status
Not open for further replies.

Ptrif

Technical User
May 19, 2003
106
US
I'm not sure if this is the right forum for this but here goes. I use an access database to grade phone reps taking phone calls. The below code averages the scores and if there is a N/A it doesnt count that into the overall average, i need to add something to the code so that each one of the "categories" is a certain percentage of that section, hence weighting each one by multiplying by say 0.25 or 0.10 etc...etc..., would anyone know how i could incorporate that with this current code without having to rewrite the entire database? Hope this made sense.....any help or suggestions are welcome!

Code:
Private Function GetAverageacc() As Single

    Dim intValidCount As Integer
    Dim intScore As Integer
    
    intValidCount = 0
    intScore = 0
    
    If Me![Accuracy] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![Accuracy]
    End If
    If Me![investigation] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![investigation]
    End If
    If Me![basic navigation] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![basic navigation]
    End If
    If Me![followup] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![followup]
    End If
    If Me![demographics] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![demographics]
    End If
    If Me![Authentication] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![Authentication]
    End If
    If Me![work_flow] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![work_flow]
    End If
    If Me![fulfillment] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![fulfillment]
    End If
    If Me![escalation] <> "N/A" Then
        intValidCount = intValidCount + 1
        intScore = intScore + Me![escalation]
        End If
        

   

    If intValidCount = 0 Then
        Me![total1] = 0
    Else
        Me![total1] = intScore / intValidCount
    End If

End Function
 
If you dont mind, could you clarify what you are trying to do?
Give each catagory a "weight" so that one has more affect in the avarage, where the weights, in decimal format, add up to 1? I'm likely reading wrong, but if i know what to do i might be able to help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top