Count - if statement....

  • Thread starter Thread starter learning_codes
  • Start date Start date
L

learning_codes

Hi,

I created a box called TXT_Completed for me to put ="Completed: " &
Sum(IIf([Answer] like "1",1,0)) & " of " & Count (*)
and it works.

I have four groups and I want to set like below and I'm not able to
make it work.

="Completed: IIf([GroupA] like "1",1,0)) & " of " & Count (*)
and
next one,

="Completed: IIf([GroupB] like "1",1,0)) & " of " & Count (*)

I'm struggling last two A and B. Your help would be much
appreciated. I don't know if I do the right thing.

Thanks
 
Learning_codes,

The syntax of the one that works and the one that doesn't are different.

Also, the use of the "Like" keyword here is not necessary, apparently,
as you have no wildcard.

Therefore, try:
="Completed: " & Sum(IIf([GroupA]="1",1,0)) & " of " & Count (*)

If I have misunderstood, perhaps you can give some more details of where
these textboxes are located, and what is the meaning of the fields such
as Answer and GroupA and GroupB and what is the relationship between them.
 
Learning_codes,

The syntax of the one that works and the one that doesn't are different.

Also, the use of the "Like" keyword here is not necessary, apparently,
as you have no wildcard.

Therefore, try:
="Completed: " & Sum(IIf([GroupA]="1",1,0)) & " of " & Count (*)

If I have misunderstood, perhaps you can give some more details of where
these textboxes are located, and what is the meaning of the fields such
as Answer and GroupA and GroupB and what is the relationship between them.

--
Steve Schapel, Microsoft Access MVP



I created a box called  TXT_Completed for me to put ="Completed: " &
Sum(IIf([Answer] like "1",1,0)) & " of " & Count (*)
 and it works.
I have four groups and I want to set like below and I'm not able to
make it work.
="Completed: IIf([GroupA] like "1",1,0)) & " of " & Count (*)
and
next one,
="Completed: IIf([GroupB] like "1",1,0)) & " of " & Count (*)
I'm struggling last two A and B.   Your help would be much
appreciated.  I don't know if I do the right thing.
Thanks- Hide quoted text -

- Show quoted text -

Thanks for getting back to me. My mistake.. it should be like this
but still not able to get the count.

="Completed: IIf([GroupA] like "Product A",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)
="Completed: IIf([GroupB] like "Product B",Sum(IIf([Answer] like "1",
1,0)) & " of " & Count (*)
 
Learning_codes,

As I said before, I am puzzled why you are using "Like", it doesn't make
sense.

Are you puttting this stuff into your posts here by copy/paste, or are
you re-typing? Copy/paste is best, so we can try to diagnise exactly
what you are working with.

These expressions have incorrect syntax. There is no closing ")" for
one of the IIf() functions, and also no "false part" argument for the
IIf(). Also, a string closure " was missing, and there is a space
between the Count and the "(".

As far as I can work out, I think you want this:
="Completed: " & IIf([GroupA]="Product A",Sum(IIf([Answer]="1",1,0)) & "
of " & Count(*),0)
 

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

Similar Threads

Access count a field in access report 2
Sum If function in textbox 0
Query Help 3
Count Function 6
Statement 1
union query problem 16
Between date with greater than or eaqual to 4
Sum(IIF statement 1

Back
Top