Results 1 to 5 of 5
  1. #1
    jdr3091 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2

    Help with iff statment trying to count people within a certain parameter

    I need to write a query statement that counts people not within a certain number value. The column that I am using could have 4 values: The field is empty; the field has a number between 37 & 39; the field could have a number not between 37 & 39; or the field could have UTD. I thought I could use an iff statement that would ask if the value was > =37 & <=39. Then if this was true give them a 0 value if false give a 1 value. That way I could count the ones and obtain the number of exclusions. Since there would be null values I thought I could use the Nz function to give the empty fields a 0 value and then they wouldn’t affect the count. However, I need to count the UTDs I thought the statement would generally be something like this:

    Excluded by gest: Iff(Nz(between [37] AND [39]),0,1),0))

    I was thinking this could go in the field row of the QBE and expression would be in the total row.



    But what would I do with the UTDs? Could I assign UTD a zero value and then query the column a second time for UTD only? How would I write that? I’m way beyond my SQL writing and syntax ability and wonder if I need a vbs?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    What is UTD? Is that literal text value in the field? This is a text not number type field? What is the range of number data in this field?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848

  4. #4
    jdr3091 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Posts
    2
    UTD is literal text which needs a separate count. I have the field set as text. the number value range is 1-50; but there can be some of the fields that are blank.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,628
    The field is text which means alpha sort and the number 10 will sort before the number 2. Need placeholder 0, like 01, 02, 03, 04, 05, 06, 07, 08, 09. Or make it a number field and assign something like 999 to represent UTD.

    And as orange noted, the function is IIf.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Parameter Query/Report Question to Count Text
    By Lettyg82 in forum Reports
    Replies: 6
    Last Post: 08-13-2012, 03:47 PM
  2. if statment or case statment?
    By whojstall11 in forum Forms
    Replies: 4
    Last Post: 07-09-2012, 01:44 PM
  3. Count + between + parameter function
    By teirrah1995 in forum Queries
    Replies: 3
    Last Post: 08-11-2011, 10:25 AM
  4. Count Number of People Per Product
    By Lorlai in forum Queries
    Replies: 3
    Last Post: 06-29-2011, 06:15 PM
  5. Replies: 0
    Last Post: 12-28-2009, 12:14 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums