Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

average calculations excluding zero's

Status
Not open for further replies.

keelerobert

Technical User
Joined
Aug 2, 2005
Messages
17
I have a subform that lists minutes logged in by employees. I need to know the average of the minutes logged but only include the days when minutes are logged. i.e. on four days the minutes are 5 3 0 0. I want the average to calculate 4 not 2. Because two of the fields contain a zero and not null they are included in the average. Can i tell the average command to ignore the zero's?
 
try setting the control source to the davg function

=DAvg("minutes ", "time", "where minutes >0")
 
I understand the first and last part of the davg command. The middle part confusses me. You have labeled it "time". Is that a field of the subform or the subform itself.
 
so DAvg doesn't work on a subform. A subform already has the table name embedded into it and typing a table name in a command where the table already exists causes a #name error.
 
DAvg should work fine, whether or not it references the same table as the one the form references. There is an error in PWise's example though, there shouldn't be a "where" in the last parameter. I.E., should be something like:
Code:
=DAvg("Num","ExcelTable","Num > 0")

I've tested the above in a form that was based on ExcelTable.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top