Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Count information in a combbox

Discussion in 'Information Technology' started by JOM, Nov 2, 2005.

  1. JOM

    JOM
    Expand Collapse
    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?
     
  2. Loading...

    Similar Threads Forum Date
    Ashdoc's Movie Review---The Accountant Theatre, Movies & Cinema Oct 21, 2016
    Gurmat Vichaar | Futility Of Counting Paaths | April 12, 2016 Gurmat Vichaar Apr 23, 2016
    wolf count Blogs Oct 17, 2015
    recount Blogs Oct 17, 2015
    Events Banda Singh Bahadur's Martyrdom - An Eyewitness Account History of Sikhism Mar 26, 2015

  3. xRoachx

    xRoachx
    Expand Collapse
    Guest

    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.

    "JOM" wrote:

    > 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?
     
  4. Ofer

    Ofer
    Expand Collapse
    Guest

    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" wrote:

    > 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?
     
  5. JOM

    JOM
    Expand Collapse
    Guest

    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" wrote:

    > 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" wrote:
    >
    > > 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?
     
  6. Ofer

    Ofer
    Expand Collapse
    Guest

    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" wrote:

    > 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" wrote:
    >
    > > 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" wrote:
    > >
    > > > 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?
     

Share This Page