Using Count on 2 or more criteria?

Jakboi

Death by Access
Local time
Today, 15:04
Joined
Nov 20, 2006
Messages
303
Hello,

I am putting together a report that has a summary of some information. I am tryign to also include summarys for a certain field, counts if it equals more than one criteria.

I have tried the following:

=Count(IIf([CLASSIFICATION]="Preliminary",0) & ([OFFICER1]="DB",0))

How do I use count and have it depend on several criteria?

I have tried a few things but looking for some insight. The above doesnt work but think I am close.

Thanks.
 
try
=Count(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",1,0)
If you want both conditions in your total. In terms of the Count; The ',1' means 'add 1' and the ',0' means 'else add 0'
 
Last edited:
I think that will need to be Sum not Count

=Sum(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",1,0))

brian
 
Thanks for the help. This did the job:

=Sum(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",1,0))

Now another part to this report I am trying to put together. I used this to sum all of the preliminary classification amount totals:

=Sum(IIf([CLASSIFICATION]="Preliminary",[AMOUNT],0))

Now I am trying to total the Preliminary classifications for a certain officers.

I have tried:

=Sum(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",1,0 ,[AMOUNT],0)) **says wrong number of arguments

=Sum(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",1,0) ,([AMOUNT],0) **says missing bracket or vertical bar


I figure it must be close to this one but am new to access:

=Sum(IIf([CLASSIFICATION]="Preliminary",[AMOUNT],0))

Any insight would be helpful. Thanks.
 
Nevermind. I found something that worked. :)

=Sum(IIf([CLASSIFICATION]="Preliminary" And [OFFICER1]="DB",[AMOUNT],0))
 

Users who are viewing this thread

Back
Top Bottom