View Full Version : need help with counting


slimjen1
11-07-2007, 08:26 AM
Hello All,
I need help on a report. The user want a report to count if a the field contains "y". Also, They want to count the fields with multiple "y". For example:

Name Field1 Field2 Field3 Field4 Field5 Field6 Field7 Field8
Green Y Y Y White Y Y Y
Gray Y Y Y
Brown Y Y Y
Black Y Y Y
Say their are five names on the report. Their are seven fields.
The first name has "Y" for TXT_Field1, TXT_Field7 and TXT_Field8. The rest of the fields are blank.
The second name has "Y" for TXT_Field1, TXT_Field7 and TXT_Field8. ""
The third name has "Y" for TXT_Field2, TXT_Field7 and TXT_Field8. ""
The fourth name has "y" for TXT_Field2, TXT_Field7 and TXT_Field8. ""
The fifth name has "y" for TXT_Field1, TXT_Field7 and TXT_Field8. ""
So for the total on the page:
Fields 1, 7 and 8=3
Fields 2, 7and 8 =2 Total =5

They want the total number of people on the report but broken down to what fields each has.

I've been trying to use

Code:
=Sum(IIf([TXT_Field1] ="y" And [TXT_Field7] ="y" And [TXT_Field8]="y", 1, 0))
I keep getting the total number of records in the database (250) instead of the breakdown for each field. For example: Field1=250 Field2=250 etc...
I'm looking for something like:
Names with field1 = "Y" is 50
Names with field1 and field2 = "Y" is 80
Names with field1 and field2 and field3 ="Y" 10
Names with field1 and field2 and field3 and field4="Y" 70
Names with field1 and field2 and field3 and field4 and field5="Y" 10
Names with field1 and field2 and field3 and field4 and field5 and field6="Y" 10
Names with field1 and field2 and field3 and field4 and field5 and field6 and field7="Y" 10
Names with field1 and field2 and field3 and field4 and field5 and field6 and field7 and field8="Y" 10 for a total of 250
I am hoping I'm explaining this clear enough for you to help me. It took me a long time to realize what they wanted.