Results 1 to 3 of 3
  1. #1
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170

    SumIF Statement in Query

    Hello,



    I am capturing production right now as operators scan in barcodes into the database, and want to compare that to an hourly goal that is being captured with each record.

    So each record captured looks like this:

    Johnny, 1 Unit Produced, Goal 35, Time Added (m/d/yyyy h:mm/ss AM/PM)

    Now I am trying to build a query that I can run a report off of that shows the total amount they did vs. their daily goal, and currently have this:

    Code:
    SELECT Format([Time Added],"m/d/yyyy") AS Expr1, tblMainDB.Operator, Count(tblMainDB.LID) AS CountOfLID, tblMainDB.Process, Sum(tblMainDB.Goal) AS SumOfGoal
    FROM tblMainDB
    GROUP BY Format([Time Added],"m/d/yyyy"), tblMainDB.Operator, tblMainDB.Process
    HAVING (((tblMainDB.Process)="Authenticate"));
    This however sums up All the values in the Goal field. I need it to show from the hours of 9 AM - 10 AM Operators were ringing their production units in under a goal of 35 or 26 or 15, and to add those numbers up over the hour. My first thought is a SUMIF function? Does anyone have any ideas?

    Thanks!

  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
    52,920
    Calculate a field that has the hour as a value that can be grouped on as well as the m/d/yyyy, operator, process.

    Hr: Hour([Time Added])
    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
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Solved. Thank you.

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

Similar Threads

  1. sumif in Access
    By JGrots in forum Queries
    Replies: 12
    Last Post: 01-17-2013, 02:37 PM
  2. if statement in sql statement, query builder
    By 54.69.6d.20 in forum Access
    Replies: 4
    Last Post: 09-11-2012, 07:38 AM
  3. Complex "sumif" style formula
    By groonpooch in forum Queries
    Replies: 3
    Last Post: 12-16-2011, 07:05 PM
  4. Lookup and Sumif
    By hatimn in forum Queries
    Replies: 7
    Last Post: 07-18-2011, 11:50 AM
  5. Sumif in an Access report
    By tigers in forum Reports
    Replies: 0
    Last Post: 03-15-2007, 12:19 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