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

    Having Trouble Getting a Percent off two numbers

    (Sorry I am new to this and I think I did it right?) I have a Table with "Enrollment" and "Capacity" and I am trying to figure out the percentage of classes are closed? By closed I mean Enrollment = Capacity and then taking THAT number of closed classes divided by the total number of classes.

    EDIT: Here it is if anyone cares or let me know if I should delete this post

    SELECT SUM( IIF(PerceentOfClassesClosed = "Closed", 1.0, 0.0) ) / COUNT(1)



    FROM (SELECT IIF((Class.Enrollment / Class.Capacity) = 1, "Closed", "Open") AS PerceentOfClassesClosed FROM Class)



  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,772
    Combine how and what error?

    Aggregate calcs are often easiest done on a report. Aggregate calcs are done in group or report header/footer textbox.

    Did you mean to spell percent with 3 e's?
    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
    shifty is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    5
    I did not lol but anyway I actually figured it out

    Here it is if anyone cares or let me know if I should delete this post
    SELECT SUM( IIF(PerceentOfClassesClosed = "Closed", 1.0, 0.0) ) / COUNT(1)

    FROM (SELECT IIF((Class.Enrollment / Class.Capacity) = 1, "Closed", "Open") AS PerceentOfClassesClosed FROM Class)

  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,772
    Glad you figured it out. Thanks for providing the solution. Was no need to edit the original post.
    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. Percent problems
    By rice1973 in forum Programming
    Replies: 1
    Last Post: 09-02-2014, 05:36 PM
  2. Replies: 8
    Last Post: 03-10-2014, 11:47 AM
  3. percent
    By blackstatic42 in forum Access
    Replies: 4
    Last Post: 06-02-2013, 10:28 PM
  4. Replies: 1
    Last Post: 11-29-2011, 08:43 AM
  5. Auto Updating Percent
    By walter189 in forum Reports
    Replies: 1
    Last Post: 09-07-2011, 01:34 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