Count IIF

T

tlynnlow

I have a field that has two possible answer choices for example: "red apples"
or "green apples". In my report, I would like to count how many people
picked "red apples". I cannot get this to work. Any suggestions?
 
F

fredg

I have a field that has two possible answer choices for example: "red apples"
or "green apples". In my report, I would like to count how many people
picked "red apples". I cannot get this to work. Any suggestions?

And the datatype of this field is what? Text? Number? Boolean?
Assuming, from your example, that it is Text datatype, then. using an
unbound control, set it's control source to:
=Sum(IIf([FieldName] = "red apples",1,0)
Use another control:
=Sum(IIf([FieldName] = "green apples",1,0)
You can place the control anywhere in the report except the Page
Header or Page Footer.
 

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