Count information in a combbox

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

Guest

I have a combo box named Groups on my report, that contains the following
information GR1, Gr2, Gr3. in my report footer I would like to count how
many Gr1, Gr2 and Gr3 are for my report.....

What I have is iif([Groups]="Gr1",
abs(sum([Groups]="Gr1")),iif([Groups]="Gr2",
abs(sum([Groups]="Gr2")),iif([Groups]="Gr3", abs(sum([Groups]="Gr3")),"NA")))

But I only get the result of Gr1 and the rest are not counted, how do I
count them?
 
Assuming you built your report on a query, you can do the counting in the
query, 1 field for each group, then sum the fields in your report. Or you
can create 3 separate fields and sum using the criteria you specified below.

However, you wouldn't include nested IIf's, but one IIf for each field.
But you cannot sum separate values independently on the same field, which is
what it appears you have attempted.

If I misread your post and you are trying to accomplish something different,
let me know.
 
Unfortunatly I don't want to add the 3 groups tofgether rather I want to sum
them up and view them differently so if I have Gr1 = 10 Gr2 = 1 Gr3 = 0
Something like that!

Ofer said:
Try this

=Sum(IIf([Groups] In ("Gr1","Gr2","Gr3"),1,0))
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



JOM said:
I have a combo box named Groups on my report, that contains the following
information GR1, Gr2, Gr3. in my report footer I would like to count how
many Gr1, Gr2 and Gr3 are for my report.....

What I have is iif([Groups]="Gr1",
abs(sum([Groups]="Gr1")),iif([Groups]="Gr2",
abs(sum([Groups]="Gr2")),iif([Groups]="Gr3", abs(sum([Groups]="Gr3")),"NA")))

But I only get the result of Gr1 and the rest are not counted, how do I
count them?
 
So create a seperate field for each one of them and in the control source of
each field write
=Sum(IIf([Groups] = "Gr1",1,0))
=Sum(IIf([Groups] = "Gr2",1,0))
=Sum(IIf([Groups] = "Gr3",1,0))

--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



JOM said:
Unfortunatly I don't want to add the 3 groups tofgether rather I want to sum
them up and view them differently so if I have Gr1 = 10 Gr2 = 1 Gr3 = 0
Something like that!

Ofer said:
Try this

=Sum(IIf([Groups] In ("Gr1","Gr2","Gr3"),1,0))
--
If I answered your question, please mark it as an answer. That way, it will
stay saved for a longer time, so other can benifit from it.

Good luck



JOM said:
I have a combo box named Groups on my report, that contains the following
information GR1, Gr2, Gr3. in my report footer I would like to count how
many Gr1, Gr2 and Gr3 are for my report.....

What I have is iif([Groups]="Gr1",
abs(sum([Groups]="Gr1")),iif([Groups]="Gr2",
abs(sum([Groups]="Gr2")),iif([Groups]="Gr3", abs(sum([Groups]="Gr3")),"NA")))

But I only get the result of Gr1 and the rest are not counted, how do I
count them?
 

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

Back
Top