counting a yes/no field

S

SusanArtman

I'm using Access 2002.

In the grouping footer I am trying to write a formula to count the number of
"Yes" of yes/no field. The result I receive is counting the amount of items
in the group.
date excused
12/3/2007 yes
12/102007 yes
12/20/2007 no

formula =count([excused]=yes) Returns 3 not 2
formula =count([excused]=true) Returns 3 not 2

Can anyone help?
Thanks. Susan
 
J

Jeff Boyce

Susan

You are counting the number of [excused].

If you Sum([excused]), you'll get a number that represent how may are
"true". If your data is stored in Access/JET, it will be a negative number.
If stored in SQL-Server, it will be a positive number (the same number).

To be sure you are handling whatever situation your data is in, you can use:
Abs(Sum([excused]))
to get a positive number representing the count of "true"s in the field.

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
S

SusanArtman

Thanks Jeff. I just posted another question you might be able to help me with.
Susan


Jeff Boyce said:
Susan

You are counting the number of [excused].

If you Sum([excused]), you'll get a number that represent how may are
"true". If your data is stored in Access/JET, it will be a negative number.
If stored in SQL-Server, it will be a positive number (the same number).

To be sure you are handling whatever situation your data is in, you can use:
Abs(Sum([excused]))
to get a positive number representing the count of "true"s in the field.

Regards

Jeff Boyce
Microsoft Office/Access MVP


SusanArtman said:
I'm using Access 2002.

In the grouping footer I am trying to write a formula to count the number
of
"Yes" of yes/no field. The result I receive is counting the amount of
items
in the group.
date excused
12/3/2007 yes
12/102007 yes
12/20/2007 no

formula =count([excused]=yes) Returns 3 not 2
formula =count([excused]=true) Returns 3 not 2

Can anyone help?
Thanks. Susan
 

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