Results 1 to 6 of 6
  1. #1
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25

    Count IIF with multi values

    Hi,



    I want to count the records with multi iif conditions. I am able to get one condition right but don't know how to put more than 1.

    Eg: =Count(IIf([Step #]=1 And [Type of Work]=1,0))

    But I am not able to get if I want step#1, step#2 and step#3 all together with type of work = 1

    Please help

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Not sure what you want.

    Is [Step #] the name of a field? You want to count records where [Type of Work] = 1 AND [Step #] = 1 or 2 or 3? Are there other values?


    BTW, advise no spaces or special characters/punctuation (underscore is exception) in naming convention. Better would be StepNum, StepNo, Step_Num.
    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
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25
    Hi,

    Yes Step# and type of work are field names from a table. step # are about 15 and type of work are 2 (TW and PW)

    Thanks for the suggestion reg the field names.

    Regards

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Didn't answer question about what data you want to count.

    Maybe:

    Sum(IIf([Type of Work]=1 AND ([Step #]=1 Or [Step #]=2 Or [Step #]=3), 1, 0))

    or

    Sum(IIf([Type of Work]=1 AND Not IsNull(Choose(Nz([Step #],0), 1, 2, 3)),1 ,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.

  5. #5
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25
    Hi,

    i want to count the records with below situations

    * step # is 4,5, 6 & 7 and type of work is 1
    * step # is 8,9,10,11 & 12 and type of work is 1

    similarly both above sitautions with type of work = 2

    i will try ur above given syntax tomm.

    thanks for ur time.

    regards

  6. #6
    harpreett.singhh@gmail.co is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    25
    I tried the option 1 and its working. Thanks a lot June7. Cheers.

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

Similar Threads

  1. Delete values in a multi-columned combo box
    By enquiries in forum Programming
    Replies: 8
    Last Post: 04-10-2014, 02:17 PM
  2. Multi Selection Box User submitted Values
    By LordPanzer in forum Access
    Replies: 3
    Last Post: 09-30-2013, 01:32 PM
  3. Replies: 14
    Last Post: 07-25-2013, 11:17 PM
  4. Multi-value field count
    By whitneynf08 in forum Queries
    Replies: 3
    Last Post: 08-07-2012, 11:02 AM
  5. Replies: 1
    Last Post: 03-09-2006, 12:12 PM

Tags for this Thread

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