Averaging and not counting Zero's

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there a way to average a group of numbers in a query and not include the
0. I know I could say Not 0 in the critieria, but I need the other fields to
show up regardless of this one particular record as a zero
 
SELECT ..., AVG(iif(fieldName =0, null, fieldName) ), ...
FROM somewhere
GROUP BY ...



Note that the 'other' fields would have to either be aggregated (MAX, MIN,
FIRST, LAST, .... ) either part of the GROUP BY list.

Changing the zero for a null would make the value to be discarded by AVG (as
it also occurs for any aggregate over a field name).

Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Displaying zeros in cells 2
AVERAGE 4
Division by Zero Error 1
Average Function 4
Average time with a single entry 2
nulls 4
Find unmatched records by name 5
Count Only Non-Zero Values 1

Back
Top