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!

count number of yes repsonses 3

Status
Not open for further replies.

swimtiger

Technical User
Aug 5, 2002
25
US
I have a table with 14 yes/no fields. I want to be able to count the number of yes responses that a user has.
 
Im not sure about now, but true used to be -1 and false 0 and you could put 0 or -1 into a query as a criteria and it would give you the correct result. If it still is, it seems to me you could create a calculated field in a query which summed the fields and multiplied the result by -1 to give you yes responses and sum the fields and add the result to 14 (because the total of yes is a negative number, this would give you the difference) for the number of no responses.
 
Use the following in a Form or Report footer

=Sum(IIF([NAmeofYesNoField],1,0)) Sums the Yes's

=Sum(IIF([NAmeofYesNoField],0,1)) Sums the No's

Neil Berryman
IT Trainer
neil_berryman@btopenworld.com
 
Since Yes =-1 and No = 0, if you add up your 14 fields and take its absolute value, that will be your count of Yes values:
Code:
=Sum(Abs([YesNoField1]+[YesNoField2]+[YesNoField3]....etc))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top