Welcome to SPN

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

Sign Up Now!

I Need An Expression To Return Multiple Results

Discussion in 'Information Technology' started by Lori, Jul 28, 2006.

  1. Lori

    Lori
    Expand Collapse
    Guest

    I've tried a varity of possibilities. I'm trying to write an expression that
    will return different answers based on the results in a given field. the
    FINAL: IIf([TOTAL]>"84","4") works perfectly but I'm looking for a way to get
    the answer to come up with <"65",1, between 65 and 74, 2 and between 75 and
    84, 3.

    Can anyone help???
    --
    Lori A. Pong
     
  2. Loading...


  3. OP
    Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    FINAL: IIf([TOTAL] < "65", "1", IIf([TOTAL] <= "74", "2", IIf([TOTAL] <=
    "84","3", "4")))

    or

    FINAL: Switch([TOTAL] < "65", "1", [TOTAL] >= "65" And [TOTAL] <= "74", "2",
    [TOTAL] > "74" And [TOTAL] <= "84", "3", [TOTAL] > "84", "4)

    On the other hand, from the name, I would expect [TOTAL] to be a numeric
    field, not text, in which case you don't want the quotes around the values.

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Lori" <Lori@discussions.microsoft.com> wrote in message
    news:CC88952F-2BCF-496C-BF32-D47C5D389555@microsoft.com...
    > I've tried a varity of possibilities. I'm trying to write an expression

    that
    > will return different answers based on the results in a given field. the
    > FINAL: IIf([TOTAL]>"84","4") works perfectly but I'm looking for a way to

    get
    > the answer to come up with <"65",1, between 65 and 74, 2 and between 75

    and
    > 84, 3.
    >
    > Can anyone help???
    > --
    > Lori A. Pong
     
  4. OP
    Lori

    Lori
    Expand Collapse
    Guest

    Thanks, your a life saver. It worked perfect!
    --
    Lori A. Pong


    "Douglas J Steele" wrote:

    > FINAL: IIf([TOTAL] < "65", "1", IIf([TOTAL] <= "74", "2", IIf([TOTAL] <=
    > "84","3", "4")))
    >
    > or
    >
    > FINAL: Switch([TOTAL] < "65", "1", [TOTAL] >= "65" And [TOTAL] <= "74", "2",
    > [TOTAL] > "74" And [TOTAL] <= "84", "3", [TOTAL] > "84", "4)
    >
    > On the other hand, from the name, I would expect [TOTAL] to be a numeric
    > field, not text, in which case you don't want the quotes around the values.
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Lori" <Lori@discussions.microsoft.com> wrote in message
    > news:CC88952F-2BCF-496C-BF32-D47C5D389555@microsoft.com...
    > > I've tried a varity of possibilities. I'm trying to write an expression

    > that
    > > will return different answers based on the results in a given field. the
    > > FINAL: IIf([TOTAL]>"84","4") works perfectly but I'm looking for a way to

    > get
    > > the answer to come up with <"65",1, between 65 and 74, 2 and between 75

    > and
    > > 84, 3.
    > >
    > > Can anyone help???
    > > --
    > > Lori A. Pong

    >
    >
    >
     
Since you're here... we have a small favor to ask...     Become a Supporter      ::     Make a Contribution     


Share This Page