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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Report SUM field question

Status
Not open for further replies.

debq

Technical User
Aug 7, 2008
50
US
Hello,

I have a report that provides results of a survey. The survey has 10 questions, 6 are answered with a "YES/NO" and 4 are Based on a Scale: 5=Completely Satisfactory, 4=Mostly Satisfactory ect... I am able to calculate to total number of "yes" answers using =SUM(IIf([Promptness]="Yes",1,0)). My problem occurs when I try to calculate the number of answers that are "5=Completely Satisfactory". I think that using the "=" as a result in my table is causing this issue. How can I sum the total number of answers that are "5=Completely Satisfactory and "4=Mostly Satisfactory in one total per question on my survey?
 
Hi mate,

=SUM(IIf(val([ScaledAnswer]) between 4 and 5, 1,0))

will give you the number of answers that are 4 or 5. If you actually want to add up the values of the 4's and 5's you can of course adjust:

=SUM(IIf(val([ScaledAnswer]) between 4 and 5, val([ScaledAnswer]),0))

Cheers,

JB
 
I would have structured the table differently (normalized). My solution would be to create a union query so that each answer to each question created a record. Then you can use a simple group by query that counts by Question and Answer.

Duane
Hook'D on Access
MS Access MVP
 
YEAH!! Thank you JB, your solution works.

AND yes,Duane, I have learned a very valuable lesson about table creation and will not make the same mistake on future projects.

Thank you both for your help and patience. I still have much to learn but am so excited by Access and by this forum.
debq
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top