Count If

  • Thread starter Thread starter rami rami
  • Start date Start date
In the following, replace MyField with the real name of your field.

In the report (or group) footer put a text box in which you can type

=Sum([MyField]=1 OR [MyField]=2 OR [MyField]=0) * -1

Alternatively, you may want to add 3 fields to your query

eg

Has1: IIF([MyField]=1,1,0)

Has2: IIF([MyField]=2,1,0)

Has0: IIF([MyField]=0,1,0)

Now you can sum up the indivual responses in a text box with eg

=Sum(Has1)

or sum up the whole group with

=Sum(Has1) + Sum(Has2) + Sum(Has0)

Evi
 
Maybe something like this in the Control Source of a text box in the footer:
=DCount("*","[YourTable]","[SomeField] >= " & 0 & " AND [SomeField] <= " &
2)
Use your actual field and table names in place of YourTable and SomeField.
The suggestion assumes the field is a number field. If it is text you will
need a somewhat different approach, but I will await further details from
you if that is the case.
 
Back
Top