Results 1 to 12 of 12
  1. #1
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7

    Need a total count of "Yes" entries for records within a specified date range.


    I have a working(two table) database (Access 2007) consisting of records with 78 Yes/No/N/A entries. Using a date range as criteria, the database returns all records within the range. I would like to get a count of "Yes" entries for each record and a count of total entries for each record to be used for a percentage claculation. I can currently export the data to an Xcel Spreadsheet and perform the calculations myself but think it would be mre streamlined to complete all the functions within Access. This is the most in depth I have ever gotten with Access and am floundering. All suggestions appreciated.

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You can create, name and save query objects with Access. Use the Query Builder via the "Query Design" option under the Create tab in the Ribbon. While in design view of your new query, use the Totals option towards the Right of the ribbon. Now, towards the bottom of the window, there is a grid and the grid will have a field for Totals. There is a list of options available to select a totals function for a given field/column in your query. Default for the Totals is "Group By".

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Sounds like you're saying that there are 78 fields? If so, not a normalized design and harder to work with. You'd have to add them up like:

    IIf(Field1="Yes", 1, 0) + IIf(Field2="Yes", 1, 0) +...
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    That is exactly what I have done and the result is a '1' for every "Yes" entry. What kind of query could I build to give me a total of all the "1's"?

  5. #5
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    I guess I had better start looking at building a new database. I did not build this one, just trying to work with what was handed to me.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I would certainly consider it. If you stay with it, what exactly did you do that resulted in a '1' for every yes? What I posted should result in the total.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    Paul,
    In the Expression(s) I wrote, I used [] around the Field ID i.e. IIf([Question1]="Yes","1","0") + ...

  8. #8
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    Using exactly what you provided, I got a result of 0. That was: IIf(Question 1="Yes", 1, 0) +IIf(Question 2="Yes",1, 0) + IIf(Question 3="Yes", 1 , 0)....

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The brackets would be required if the field has inadvisable spaces in it. You don't want quotes around the 1 and 0 though. That makes them text instead of numbers.

    IIf([Question1]="Yes",1,0)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    Finally ended up with Sum(IIf([Question 1]="Yes",1,0)+IIf([Question2]="Yes",1,0) +....IIf([Question78]="Yes",1,0)) AS Positives, 78 AS Total and then anothr major string ending with the criteria for start and end date. It works. Been looking at building a new datatbase and this normalization thing would be a few more table and not nearly as many fields!!!

  11. #11
    DonO is offline Novice
    Windows XP Access 2007
    Join Date
    May 2014
    Posts
    7
    Thank You for your help! We'll mark this as solved!

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 2
    Last Post: 11-26-2012, 11:12 PM
  2. Replies: 2
    Last Post: 09-29-2012, 11:22 PM
  3. Replies: 4
    Last Post: 03-14-2012, 09:05 AM
  4. Replies: 1
    Last Post: 03-30-2011, 06:16 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