Results 1 to 3 of 3
  1. #1
    New Lounger
    Join Date
    Aug 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calculation using OR (Access 2003)

    I would like to write a calculation that would return a COUNT of records in a field called [Rank] IF the field contains any of the following responses: "Excellent", "Very Good", OR "Good". I can do a calculation that looks like this:
    =Count(IIf([Rank]="Excellent",0)) and get the count of people who responded with "Excellent" but is there a way to write the calculation so that the count also includes the other two responses? There are two other possible responses which I would like left out of the count: "Fair" and "Poor".
    Thanks for your help,
    Julie

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calculation using OR (Access 2003)

    Welcome to Woody's Lounge!

    You could use an expression with DCount:
    <code>
    =DCount("*","NameOfTableOrQuery","Rank In ('Excellent','Very Good','Good')")
    </code>
    Replace NameOfTableOrQuery with the name of the table or query containing the records.

  3. #3
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Calculation using OR (Access 2003)

    I assume you wanted to use the expression in a textbox, perhaps in the footer of a continuous form? If so, you weren't far off. Try this:

    =Sum( iif( [Rank]="Excellent"),1,0)
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •