Counting 1s and zeros (1 Viewer)

echorley

Registered User.
Local time
Today, 02:38
Joined
Mar 11, 2003
Messages
131
In the table (a small sample of a test where 1 is correct and 0 is incorrect. The test question number is in the header row) below, how would I get a count of the 1's and zeros for each school, A B and C, for each question 1 to 6?


School 1 2 3 4 5 6
A 1 1 1 1 1 0
A 1 0 1 0 0 1
B 0 0 1 1 0 1
B 1 0 1 0 0 0
A 1 0 1 1 0 1
B 1 0 0 1 0 1
A 1 1 1 0 1 0
C 1 0 0 1 0 1
C 1 1 1 0 1 1
A 1 1 1 1 1 1
 

ajetrumpet

Banned
Local time
Today, 01:38
Joined
Jun 22, 2007
Messages
5,638
sorry, but this is not explained very well. there is too little information to give an answer
 

MStef

Registered User.
Local time
Today, 07:38
Joined
Oct 28, 2004
Messages
2,251
Hello echorley!
1) I agree with ajetrumpet. I think your table not normalized well.
2) I improvized something.
Look at "DemoCount1and0A2000" (attachment, zip).
Open Form1N and see.
 

Attachments

  • DemoCount1and0A2000.zip
    20.3 KB · Views: 79

namliam

The Mailman - AWF VIP
Local time
Today, 08:38
Joined
Aug 11, 2003
Messages
11,695
it would depend on your exact requirements, but I am guessing you will need a group by query and some union's

Select school, 'Q1' as Question , [1], count(*) from yourtable group by school, 'Q1'
Union all
Select school, 'Q2' as Question , [2], count(*) from yourtable group by school, 'Q2'
Union all
etc...

This data actually has a design issue in it, I presume it is a report of some kind from some place?
 

Chrisopia

Registered User.
Local time
Yesterday, 23:38
Joined
Jul 18, 2008
Messages
279
i think people are over complicating things? You just want to count all the 1's right?

Total the column, the divide it by how many there are

= Sum ([Column1]) / Count ([Column1])

the 0's are just the number of 1's subtracted from the total amount.

or for letters use the domain count:

=DCount ([Column1],"tblSchool",Column1 = 'A')

Hope this helps.
 

Users who are viewing this thread

Top Bottom