Results 1 to 2 of 2
  1. #1
    C90RanMan is offline Novice
    Windows XP Access 2003
    Join Date
    Jul 2010
    Posts
    9

    Exclamation Average help please

    I am attempting to Average across four unbound cells. Some may have values or may not but i only need to average the values that are greater than zero. Dif1, Dif2, Dif3 and Dif4 are the names of the unbound cells. I am using the following formula:



    =(Nz([Dif1],0)+Nz([Dif2],0)+Nz([Dif3],0)+Nz([Dif4],0))/(IIf(IsNull([Dif1]),0,1)
    +IIf(IsNull([Dif2]),0,1)+IIf(IsNull([Dif3]),0,1)+IIf(IsNull([Dif4]),0,1))



    Where: Dif1 = 1
    Dif2 = 1
    Dif3 = 1
    Dif4 = 0

    The answer being generated is 6 when it should be 1.

    Thanks Again

  2. #2
    pkstormy's Avatar
    pkstormy is offline Access/SQL Server Expert
    Windows XP Access 2003
    Join Date
    Mar 2010
    Location
    Madison
    Posts
    682
    I might break this apart to troubleshoot it. You could have another set of unbound fields which utilize the NZ in the expression (ie. one based on [Dif1], another based on [Dif2], etc...of your original 4 fields) to make sure it's putting in a 0 or the value in those fields and then add/average those fields.

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

Similar Threads

  1. Replies: 13
    Last Post: 05-28-2010, 11:57 AM
  2. Calculate average in a query
    By srbooth in forum Queries
    Replies: 1
    Last Post: 02-20-2010, 09:41 AM
  3. Average data
    By whites in forum Queries
    Replies: 1
    Last Post: 12-24-2009, 07:03 AM
  4. Conditioned Average
    By BravoEcho in forum Queries
    Replies: 1
    Last Post: 06-17-2009, 09:38 PM
  5. 7 day average and total
    By jannie in forum Access
    Replies: 1
    Last Post: 05-14-2009, 05:52 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