Hi,
You could do what you are trying to do by using iif() functions to determine
the number of fields greater than 0-(and thus the number that you want to
divide by), but I recommend that you look at trying to better normalize the
data for future flexibility.
Rather than having mulitple columns in your main table for prices at certain
dates, it would be much better if you created a related table with a few
fields to store the price info.
For example, you could have a table of Growers, with each one identified by
GrowerID. You could also have a table of products, with each identified by
ProductID. Then, you create a third table to store the GrowerID, the
ProductID, the date and the price.
That way, you can enter an unlimited number of dates and prices for each
grower/product combination. And, calculating things such as min price, max
price, avg price, are much easier - all you have to do is create a query that
groups by Grower and Product then add additional fields to return max price,
min price and average price. There is no need to worry about nulls, because
they wouldn't exist, and there would be no need to adjust the query as
additional dates get added (except maybe to just tweak date criteria if you
wanted to limit the stats to a date range, which would be easy to do).
Hope that helps.
-Ted Allen