Troy,
Unfortunately, your table is not normalized, which makes this type of
computation more difficult. If your table were normalized, you would have
fields (Driver, Destination, Quantity) or something like that. Then you
could just do an average of the Quantity, grouped by driver. The way you
have it, you really need a little function that you could call, something
like (untested):
Public Function Average(varValues() as Paramarray) as Variant
Dim intLoop as integer
Dim dblCount as double
Dim dblValSum as double
intCount = 0
dblValSum = 0
For intLoop = LBOUND(varValues) to UBOUND(varValues)
if not isnull(varValues(intLoop)) THEN
dblCount = dblCount + 1
dblValSum = dblValSum + varValues(intLoop)
endif
next intLoop
if dblCount = 0 then
Average = "NA"
Else
Average = dblValSum / dblCount
endif
End function
Then you would call this function in your query, something like:
SELECT [Driver], Average([Atlanta], [Nashville], [New York]) as DriverAvg
FROM yourTable
HTH
Dale
Troy Scott mindspring.com> said:
excuse me, I wasn't quiet clear. I want to count and average the rows, like
add 32 and 18 for Joe, which will be 25.
Troy