Counting in a text field for a specific group

D

dc

Hi, I am stuck and hoping someone can help me. I have a evaluation report
which the count of a text field [response] is included. It worked fine until
we threw in questions that have answers of yes, no or undecided. How can I
do a count on just the yes / no/ undecided's for a specific question? Any
help would be greatly appreciated! (oh the query that feeds the report is a
select query which is based on a crosstab query)
 
K

KARL DEWEY

Need more input! Post an example of the crosstab output. Is the crosstab
feeding the report directly are you using another query in between?
 
O

Ofer Cohen

To count the amount of time a field criteria apear you can try something like

If response Yes
=Sum(IIf([response] = "Yes" , 1 , 0))

Or, undecided
=Sum(IIf([response] = "undecided" , 1 , 0))

Sum it will Sum the 1'ns when the criteria is met
 
D

dc

Hi Ofer, thank you for the information. I added the criteria below to my
report and it does give me counts but I am not sure where the numbers its
giving me are from. As an example my first question in the evaluation is a
numeric response only however on the report it is showing a count of 2 for
yes's? I put the criteria on the questionID footer. Should I put it
somewhere else or is there something I am missing or not doing correctly?

Ofer Cohen said:
To count the amount of time a field criteria apear you can try something like

If response Yes
=Sum(IIf([response] = "Yes" , 1 , 0))

Or, undecided
=Sum(IIf([response] = "undecided" , 1 , 0))

Sum it will Sum the 1'ns when the criteria is met

--
Good Luck
BS"D


dc said:
Hi, I am stuck and hoping someone can help me. I have a evaluation report
which the count of a text field [response] is included. It worked fine until
we threw in questions that have answers of yes, no or undecided. How can I
do a count on just the yes / no/ undecided's for a specific question? Any
help would be greatly appreciated! (oh the query that feeds the report is a
select query which is based on a crosstab query)
 
D

dc

I think maybe I might of figured a piece out as to why I am getting incorrect
numbers. In reviewing your criteria its looking as though its counting the
yes's that are actually a number of 1? My data for yes and no questions are
just that, yes and nos. Should I change the criteria to read
=Sum(IIf([response] = "Yes" , Y , 0))?

Ofer Cohen said:
The Count it's actually a Sum of 1'ns when the criteria met

=Sum(Criteria is True , 1 0)

If the creiteria is not met, then it will add a 0.

This formula should be on the Report footer, or any Group footer you have.
You will get an error if it will be created on the Page Footer.

--
Good Luck
BS"D


dc said:
Hi Ofer, thank you for the information. I added the criteria below to my
report and it does give me counts but I am not sure where the numbers its
giving me are from. As an example my first question in the evaluation is a
numeric response only however on the report it is showing a count of 2 for
yes's? I put the criteria on the questionID footer. Should I put it
somewhere else or is there something I am missing or not doing correctly?

Ofer Cohen said:
To count the amount of time a field criteria apear you can try something like

If response Yes
=Sum(IIf([response] = "Yes" , 1 , 0))

Or, undecided
=Sum(IIf([response] = "undecided" , 1 , 0))

Sum it will Sum the 1'ns when the criteria is met

--
Good Luck
BS"D


:

Hi, I am stuck and hoping someone can help me. I have a evaluation report
which the count of a text field [response] is included. It worked fine until
we threw in questions that have answers of yes, no or undecided. How can I
do a count on just the yes / no/ undecided's for a specific question? Any
help would be greatly appreciated! (oh the query that feeds the report is a
select query which is based on a crosstab query)
 
O

Ofer Cohen

What is the field type of response?
What values are stored in it?

If its string and you store Yes and No, then try

=Sum(IIf([response] = "Yes" , 1 , 0))

======================================
If its Yes/No field and you store -1 and 0, then try

=Sum(IIf(Nz([response],0) = True , 1 , 0))
Or
=Sum(Abs(Nz([response],0)))

======================================
If its Numeric field and you store 1 and 0, then try

=Sum(Nz([response],0))

--
Good Luck
BS"D


dc said:
I think maybe I might of figured a piece out as to why I am getting incorrect
numbers. In reviewing your criteria its looking as though its counting the
yes's that are actually a number of 1? My data for yes and no questions are
just that, yes and nos. Should I change the criteria to read
=Sum(IIf([response] = "Yes" , Y , 0))?

Ofer Cohen said:
The Count it's actually a Sum of 1'ns when the criteria met

=Sum(Criteria is True , 1 0)

If the creiteria is not met, then it will add a 0.

This formula should be on the Report footer, or any Group footer you have.
You will get an error if it will be created on the Page Footer.

--
Good Luck
BS"D


dc said:
Hi Ofer, thank you for the information. I added the criteria below to my
report and it does give me counts but I am not sure where the numbers its
giving me are from. As an example my first question in the evaluation is a
numeric response only however on the report it is showing a count of 2 for
yes's? I put the criteria on the questionID footer. Should I put it
somewhere else or is there something I am missing or not doing correctly?

:

To count the amount of time a field criteria apear you can try something like

If response Yes
=Sum(IIf([response] = "Yes" , 1 , 0))

Or, undecided
=Sum(IIf([response] = "undecided" , 1 , 0))

Sum it will Sum the 1'ns when the criteria is met

--
Good Luck
BS"D


:

Hi, I am stuck and hoping someone can help me. I have a evaluation report
which the count of a text field [response] is included. It worked fine until
we threw in questions that have answers of yes, no or undecided. How can I
do a count on just the yes / no/ undecided's for a specific question? Any
help would be greatly appreciated! (oh the query that feeds the report is a
select query which is based on a crosstab query)
 

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