Count Function

  • Thread starter Thread starter Aurora
  • Start date Start date
A

Aurora

I am using access 2000.
I have a database with combo boxes where "yes" = 1
and "no" =2.

In my report I am listing the records with the combo box
as 1 or 2. Now i want to count the combo box (for one
field -- ex:Literature Sent. I tried, "=count([lit]=1)"
but this did not work. I tried the same formula with no
equal sign - still did not work. What am I missing?
Please help me ?

Aurora
 
Try

=Abs(Sum([Lit]=1))

A bit clearer and a bit slower

= Sum(IIF [Lit]=1,1,0)
 
John:

Thank you for answering. Your formula worked fine.
Now I am trying to count the numer of orders we received
from the people we sent literature to. Again I created an
option box for [orderplaced] with 1 = yes and 2=no.

I tried the following:

iif([lit]=1,=Abs(Sum([OrderPlaced]="1"))," ")
but this did not work. If I forget the "iif" statement
portion, I get all the orders received even if we did not
send out literature to them. Can you help me once again?

Thank you - Aurora

-----Original Message-----
Try

=Abs(Sum([Lit]=1))

A bit clearer and a bit slower

= Sum(IIF [Lit]=1,1,0)
I am using access 2000.
I have a database with combo boxes where "yes" = 1
and "no" =2.

In my report I am listing the records with the combo box
as 1 or 2. Now i want to count the combo box (for one
field -- ex:Literature Sent. I tried, "=count([lit] =1)"
but this did not work. I tried the same formula with no
equal sign - still did not work. What am I missing?
Please help me ?

Aurora
.
 
= SUM(IIF([Lit]=1 AND [OrderPlaced]=1,1,0))

That adds 1 for every case with Lit is 1 and OrderPlaced is 1

A bit faster, but probably not even noticable on most computers would be

=Abs(SUM([Lit]=1 AND [OrderPlaced]=1))
John:

Thank you for answering. Your formula worked fine.
Now I am trying to count the numer of orders we received
from the people we sent literature to. Again I created an
option box for [orderplaced] with 1 = yes and 2=no.

I tried the following:

iif([lit]=1,=Abs(Sum([OrderPlaced]="1"))," ")
but this did not work. If I forget the "iif" statement
portion, I get all the orders received even if we did not
send out literature to them. Can you help me once again?

Thank you - Aurora
-----Original Message-----
Try

=Abs(Sum([Lit]=1))

A bit clearer and a bit slower

= Sum(IIF [Lit]=1,1,0)
I am using access 2000.
I have a database with combo boxes where "yes" = 1
and "no" =2.

In my report I am listing the records with the combo box
as 1 or 2. Now i want to count the combo box (for one
field -- ex:Literature Sent. I tried, "=count([lit] =1)"
but this did not work. I tried the same formula with no
equal sign - still did not work. What am I missing?
Please help me ?

Aurora
.
 
Back
Top