Results 1 to 3 of 3
  1. #1
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2008
    Posts
    58

    Query count formula not counting blanks

    I have a query which I am trying to count the records that has a Date equal to 99999999 and Area equal to 01, 02, PR, and blanks.



    I tried the following but am only getting a count of the records that have Date equal to 99999999 and Area equal to 01, 02, PR

    All Others: Count(IIf([Date]="9999999" And [Area] In ("01","02, "PR","",Null),0))

    What am I missing?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,970
    Appear to be missing a 9 in the Count expression.

    All Others: Count(IIf([Date]="99999999" And Nz([Area],"XXX") In ("01", "02, "PR", "", "XXX"),0))

    or

    All Others: Count(IIf([Date]="99999999" And IIf([Area] Is Null, "XXX", [Area]) In ("01", "02, "PR", "", "XXX"),0))
    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
    randolphoralph is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2008
    Posts
    58
    June7 thank you. Your solution worked perfectly. The missing 9 was my fault as I typed one too many in my post.

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

Similar Threads

  1. Replies: 7
    Last Post: 06-02-2015, 09:36 AM
  2. Show Blanks in count as 0
    By WickidWe in forum Queries
    Replies: 2
    Last Post: 12-11-2013, 01:37 PM
  3. getting a #error from count(iif( formula
    By vickan240sx in forum Access
    Replies: 1
    Last Post: 09-21-2012, 08:34 PM
  4. Formula for counting shifts
    By Huddle in forum Access
    Replies: 4
    Last Post: 05-10-2012, 02:56 PM
  5. Count formula in Report
    By Amber in forum Reports
    Replies: 2
    Last Post: 01-30-2012, 08:22 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