Statistical queries

G

Gail

Have collected data from a survey of 25 questions, each
question has three possible answers, yes, no, n/a. How
do I create a query to count the three possible answers
for each question, and from there give the percentage of
total responses for each answer?
 
M

Michel Walsh

Hi,


A crosstab query can easily COUNT the number for each category. If you count
the n/a as an answer, it is just a matter to divide the result by a mere
constant, otherwise, you supply the field name rather than the * :

DCount("*", "tableNameHere", "QuestionNumber=" & QuestionNumber)

to get something, in context:

TRANSFORM whatever / DCount("*", "tableNameHere",
"QuestionNumber=" & QuestionNumber)


sure, as usual, we have to avoid a division by zero, so it will given a look
even more horrible:

TRANSFORM whatever / iif(0=DCount("*", "tableNameHere", "QuestionNumber=" &
QuestionNumber) , 1, DCount("*", "tableNameHere", "QuestionNumber=" &
QuestionNumber) )


but I assume you have got the idea... That also assumes that no
QuestinNumber value is null, else, you get an error, unless you change the
DCount third argument to

"QuestionNumber=" & Nz(QuestionNumber, "NULL")


Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top