Results 1 to 3 of 3
  1. #1
    yiega is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    7

    getting average

    hi guys,okay i have created a database and i cants seem to get the average of what i want correctly.
    so to make things simple i have one table having a studentID field,Maths,English,French and Science Fields, the subjects fields should contain the marks of each studentID e.g StudentID 1,Maths 20,English 30,French 40,Science 60....studentID 2,Maths 30,English 60 and so on...i made a query which would give me the average of the each studentID subject total marks, the query was like this
    total avergae: ([Maths]+[English]+[French]+[Science])/4..


    the query worked but there was a catch to my design like perhaps a student dint do one subject,his avergae will not show!!what i want is that even if a student dint do a subject i want his avergae to show i.e is if even if i do not fill a subject mark,an automatic 0 should be there!is this possible?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
    53,633
    Use Nz() function:

    (Nz([Maths],0)+Nz([English],0)+Nz([French],0)+Nz([Science],0))/4
    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
    yiega is offline Novice
    Windows XP Access 2007
    Join Date
    May 2013
    Posts
    7
    wow!!thanks june 7.tried the nz query and it worked out great.thanks alot !!!!

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

Similar Threads

  1. Average of an Average
    By techherbie in forum Queries
    Replies: 1
    Last Post: 03-02-2013, 02:35 PM
  2. Average of an average
    By audbene in forum Reports
    Replies: 1
    Last Post: 12-19-2012, 02:28 PM
  3. help me get the average please! :(
    By joebox8 in forum Access
    Replies: 3
    Last Post: 07-13-2011, 08:31 AM
  4. Average help please
    By C90RanMan in forum Programming
    Replies: 1
    Last Post: 08-01-2010, 12:14 PM
  5. Replies: 13
    Last Post: 05-28-2010, 11:57 AM

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