Using Count Function with Conditions

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using Accesss 2000 and have a report where I would like to use the Count
function (or something as similar and EASY) to only count the Yes values in
different Yes/No fields. For example: I can use =count[users] to get the
total number of users. I want to be able to then tell how many of those users
are physicians, how many of those users have been trained, etc.

Any help would be greatly appreciated!
 
I'm assuming the [answer] is where I put the name of my field? When I do that
and try to preview the report, I keep getting "data type mismatch in criteria
expression."

I've tried replacing "Yes" with -1 and <>0, but those don't work any better.

Any other thoughts?
 
Anita said:
I am using Accesss 2000 and have a report where I would like to use the Count
function (or something as similar and EASY) to only count the Yes values in
different Yes/No fields. For example: I can use =count[users] to get the
total number of users. I want to be able to then tell how many of those users
are physicians, how many of those users have been trained, etc.


=Abs(Sum(physician))
 
This worked great! Thank you!!!

Marshall Barton said:
Anita said:
I am using Accesss 2000 and have a report where I would like to use the Count
function (or something as similar and EASY) to only count the Yes values in
different Yes/No fields. For example: I can use =count[users] to get the
total number of users. I want to be able to then tell how many of those users
are physicians, how many of those users have been trained, etc.


=Abs(Sum(physician))
 
There are many variations of this kind of calculation.

kunon2's version would be:
=Sum(IIf(physician = True, 1, 0))
or:
=Sum(IIf(physician, 1, 0))

Another would be:
=Count(IIf(physician, 1, Null))

The one I posted before is generally considered to be the
fastest, but, most of the time, you should choose whichever
you find the easiest to understand.
--
Marsh
MVP [MS Access]


Anita said:
This worked great! Thank you!!!

Anita said:
I am using Accesss 2000 and have a report where I would like to use the Count
function (or something as similar and EASY) to only count the Yes values in
different Yes/No fields. For example: I can use =count[users] to get the
total number of users. I want to be able to then tell how many of those users
are physicians, how many of those users have been trained, etc.
Marshall Barton said:
=Abs(Sum(physician))
 
Back
Top