Using the count function with a condition in an Access Report

K

kash

Hi,

I have an access report pulling information from a query. One of the fields
is “PHD†and it has values “yesâ€, “No†& “N/Aâ€. I understand that I can use
“=count ([PHD])†in a text box to count the total number of people with PHDs
but is it possible for me to only count the number of people with PHDs (“Yesâ€
value)?

Please help!!!!!!!!!!!!!
KASH
 
F

fredg

Hi,

I have an access report pulling information from a query. One of the fields
is ´PHD¡ and it has values ´yes¡, ´No¡ & ´N/A¡. I understand that I can use
´=count ([PHD])¡ in a text box to count the total number of people with PHDs
but is it possible for me to only count the number of people with PHDs (´Yes¡
value)?

Please help!!!!!!!!!!!!!
KASH

How about an unbound control with a controls source of:

=Sum(IIf([PHD] = "Yes",1,0))
 
K

kash

Thanks a lot!
This works perfectly!

fredg said:
Hi,

I have an access report pulling information from a query. One of the fields
is “PHD†and it has values “yesâ€, “No†& “N/Aâ€. I understand that I can use
“=count ([PHD])†in a text box to count the total number of people with PHDs
but is it possible for me to only count the number of people with PHDs (“Yesâ€
value)?

Please help!!!!!!!!!!!!!
KASH

How about an unbound control with a controls source of:

=Sum(IIf([PHD] = "Yes",1,0))
 
S

SL

Hi
I am trying to do the same thing but my field name is "line No_" and the
value I want to count is 10000. I tried =Sum(IIf([line No_] = "10000",1,0)).
but keep getting errors. I am on the right track?

Thanks
SL

fredg said:
Hi,

I have an access report pulling information from a query. One of the fields
is “PHD†and it has values “yesâ€, “No†& “N/Aâ€. I understand that I can use
“=count ([PHD])†in a text box to count the total number of people with PHDs
but is it possible for me to only count the number of people with PHDs (“Yesâ€
value)?

Please help!!!!!!!!!!!!!
KASH

How about an unbound control with a controls source of:

=Sum(IIf([PHD] = "Yes",1,0))
 
D

Douglas J. Steele

Assuming it's a numeric field, get rid of the quotes around 10000

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



SL said:
Hi
I am trying to do the same thing but my field name is "line No_" and the
value I want to count is 10000. I tried =Sum(IIf([line No_] =
"10000",1,0)).
but keep getting errors. I am on the right track?

Thanks
SL

fredg said:
Hi,

I have an access report pulling information from a query. One of the
fields
is "PHD" and it has values "yes", "No" & "N/A". I understand that I
can use
"=count ([PHD])" in a text box to count the total number of people with
PHDs
but is it possible for me to only count the number of people with PHDs
("Yes"
value)?

Please help!!!!!!!!!!!!!
KASH

How about an unbound control with a controls source of:

=Sum(IIf([PHD] = "Yes",1,0))
 
T

terri

OMG !!! this is just wonderful !! thank you soooo much...been brain frying
over this type of thing all morning and you posted the answer !! thank you
thank you thank you !!!!
--
terri


fredg said:
Hi,

I have an access report pulling information from a query. One of the fields
is “PHD†and it has values “yesâ€, “No†& “N/Aâ€. I understand that I can use
“=count ([PHD])†in a text box to count the total number of people with PHDs
but is it possible for me to only count the number of people with PHDs (“Yesâ€
value)?

Please help!!!!!!!!!!!!!
KASH

How about an unbound control with a controls source of:

=Sum(IIf([PHD] = "Yes",1,0))
 
F

Fee08

THANK YOU!!!!! - this forum is fantastic as most of the things that I'm
wrestling with are already answered. This is just one of them.
Fee08
 
C

Conrad

kash said:
i really need help to find out the easiest formula to be used to find out
the total value in the report design view. if u really don't mind, i can
upload the documents and you can help me.

Conrad
thanks
 

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