Results 1 to 4 of 4
  1. #1
    hiker8117 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2007
    Posts
    10

    Avg Function

    Hello: When you look up help for this function it shows how you can Avg 2 fields like Tax and Freight: Example: AVG([Tax]+[Freight]). However, when I attempt to do this I get summed totals in lieu of an average. In my query the fields are grouped on each item and the numbers in these fields are not summed. When I create a new calculated field as an example:



    Avg([March]+[April]) I get the summed qty's and not an average. Any help would be appreciated.

    Thank you

    Gene

  2. #2
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    Avg is a group function in access query.
    This is not the same as average of 2 numbers.

    It is based on group

    So if the group contains only 1 instance.
    Then avg() will be the same value of the underlying field or expression.

  3. #3
    hiker8117 is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2007
    Posts
    10
    Quote Originally Posted by thhui View Post
    Avg is a group function in access query.
    This is not the same as average of 2 numbers.

    It is based on group

    So if the group contains only 1 instance.
    Then avg() will be the same value of the underlying field or expression.
    Not quite sure what you mean by a group function. If I group on my items in the total field, is this what you mean?

    Regards
    Gene

  4. #4
    thhui is offline Competent Performer
    Windows XP Access 2002 (version 10.0)
    Join Date
    Feb 2009
    Posts
    235
    If a table contains two fields
    [March] and [April]

    If the table has 2 rows

    Row 1 [March]=3 [April]=4
    Row 2 [March]=5 [April]=6

    Avg([March]+[April])=[(3+4)+(5+6)]/2=9

    PS: Divide by 2 because of 2 rows

    In Access SQL function, Avg is based on rows not columns

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

Similar Threads

  1. Function key shortcuts
    By dbshelp in forum Access
    Replies: 0
    Last Post: 02-03-2009, 08:53 AM
  2. Is there a function to do this....
    By Nowherefast in forum Access
    Replies: 2
    Last Post: 12-31-2008, 08:08 AM
  3. SELECT FUNCTION help please
    By scott munkirs in forum Queries
    Replies: 0
    Last Post: 10-17-2006, 07:44 AM
  4. transferspreadsheet function
    By jeffj in forum Import/Export Data
    Replies: 3
    Last Post: 03-13-2006, 11:59 AM
  5. Need Help for Dlookup function
    By wasim_sono in forum Programming
    Replies: 5
    Last Post: 01-04-2006, 08:18 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