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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to average text box values without a 0 value?

Status
Not open for further replies.

slybitz

Technical User
Mar 25, 2005
113
US
I have a report with a row of text boxes that are all pulling in values from my query. At the end of the row of text boxes I have an "average" text box that adds up all the text box values and divides by the number of text boxes. The problem is that if one of the numbers in the row is = 0 I don't want the average text box to count that one (so i don't want to include 0 in any of my average calculations). How can I go about excluding the values that are 0? i also don't want the text box values to show a null; they have to show the 0 which may make it hard. Any ideas?

Thanks for the help!!
 
Ok so here's my values (below) that I need to divide by 12. If one or more is 0 then it excludes that or those values and changes the 12 to the number of how many values there are that are not 0.

([May04]+[June04]+[July04]+[Aug04]+[Sept04]+[Oct04]+[Nov04]+[Dec04]+[Jan05]+[Feb05]+[Mar05]+[Apr05])/12

Is it possible to do something like this in a query, fairly easily?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top