Results 1 to 5 of 5
  1. #1
    julessantana is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    7

    Count "Yes" in a query

    I need a query that will return positive values to count how many "Yes" in a column. It's a checkbox. I have the query set up to "group by" the project. I used the "Sum" function in the query, and it's giving me negative answers, because "Yes" is stored as -1.

    Where/how do I change this so the results of the query will be positive, rather than negative?



    Thank you!

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Edit: rather than sum maybe you need Count.

  3. #3
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Or

    Sum(Abs([fieldname]))

    Or

    Sum([fieldname]*-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.

  4. #4
    julessantana is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    7
    Where does the expression go in the query design?

  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,772
    Only use in query if the query is a GROUP BY (Totals) aggregate query.

    In the Field row enter: Abs([fieldname]) or [fieldname] * -1 and select Sum from the Total row. Of course, use your actual field name.

    Otherwise, use in textbox in group or report header/footer section.

    If you want to display raw data detail records as well as aggregate calcs, don't use a GROUP BY query as report RecordSource.
    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. Replies: 1
    Last Post: 02-05-2015, 05:41 PM
  2. Replies: 8
    Last Post: 06-12-2014, 09:55 AM
  3. Query Table for "*" and then Count all instances
    By Steven.Allman in forum Queries
    Replies: 14
    Last Post: 09-10-2010, 07:45 PM
  4. Query Results "Count Totals"
    By tipopilotas in forum Queries
    Replies: 1
    Last Post: 03-26-2010, 10:36 PM
  5. "Count" and "Countif" in Reports
    By JMantei in forum Reports
    Replies: 1
    Last Post: 06-20-2006, 02:20 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