Results 1 to 3 of 3
  1. #1
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65

    Help with a =Sum() please


    I'm trying to tally a quantity of two conditions. Anyone able to tell me where I've gone wrong?
    I'm trying to count the number of runs per type within a report.

    This works:
    =Sum(IIf([Type] Like "arff",1))


    These don't:
    =Sum(IIf([Run] Like "yes" And [Type]="arff",1))


    =Sum(Iif([Run] Like "yes",Iif([Type] Like "arff",1)))

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    LIKE without wildcard might as well be = sign.

    If Run is a yes/no type field, don't put yes within quote marks. Value of a yes/no field is either -1 or 0, not text. Actually, don't need the LIKE or = sign with Boolean field.

    =Sum(IIf([Run] And [Type] = "arff",1))
    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
    mcmcd99 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Nov 2016
    Posts
    65
    Ahh! I see! That is really good to know, thank you.

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

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