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

count responses across a row

Status
Not open for further replies.

JoeyArr

IS-IT--Management
Nov 16, 2005
13
US
I have a simple survey form which I am trying to count 'Yes' responses to a series of 15 questions. I am not able to count across the row of data in the Responses table accurately. My formula looks as follows:

Totalyes:[question1]*-1+[question2]*-1+[question3]*-1 :[question4]*-1+[question5]*-1+[question6]*-1 +[question7]*-1+[question8]*-1+[question9]*-1 +[question10]*-1+[question11]*-1+[question12]*-1 +[question13]*-1+[question14]*-1+[question15]*-1

I'm not getting an accurate count upon submittal of the record.

Many Thanks,
Joe


 
Have a look at the Abs and DSum functions.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Code:
Public Function basCountOf(varCountof As Variant, ParamArray varMyVals() As Variant) As Variant

    'Michael Red 10/12/2006
    'To return the count or a series of values which are equal to an argument (varCountOf)

    'Sample Usage" _
    ? basCountOf("Green", "REd", "Blue", "green", "Green", "yellow", , "GrEeN", "Green") _
      4

    Dim Idx As Integer
    Dim MyVal As Variant

    For Idx = 0 To UBound(varMyVals())

        If (IsMissing(varMyVals(Idx))) Then
            GoTo NextVal
        End If

        If (varMyVals(Idx) = varCountof) Then
            MyVal = MyVal + 1
        End If

NextVal:
    Next Idx

    basCountOf = MyVal

End Function



MichaelRed


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top