Calculate an Average Without Zero Values in Microsoft Access
Question details
Calculate the average of a numeric field in Microsoft Access without including zero values.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- A user wants an aggregate query to average only nonzero values in a table.
- Observed behavior
- A normal average includes zero values, which can lower the result.
Identify the table and numeric field you want to average, and replace the example names in the SQL with your own. Decide whether negative values should be included; the examples below include all nonzero values.
Filter Out Zeros Before Calculating the Average
Use an aggregate query when you only need the average of nonzero records.
In Access, select Create > Query Design, then switch to SQL View.
Enter: SELECT Avg([ValueField]) AS AverageValue FROM [YourTable] WHERE [ValueField] <> 0; Replace [ValueField] and [YourTable] with your field and table names.
Select Run to display the average. Access excludes zero and Null values from this calculation.

Use a Conditional Average Without Filtering Out Records
Use a conditional expression when other query calculations need to retain records with zero values.
Calculate Nonzero Averages in WPS Spreadsheets
WPS Office is a free, lightweight Office alternative with a familiar interface. For spreadsheet data, WPS Spreadsheets can calculate a nonzero average with AVERAGEIF. It does not modify Access queries, but it can help you work with exported spreadsheet data.

Frequently Asked Questions
Does the nonzero average include negative numbers?
Yes. The condition [ValueField] <> 0 includes both negative and positive values. Use [ValueField] > 0 in the query criteria if you want only positive values.
What happens if every value is zero or Null?
The average returns Null because there are no qualifying values. To display 0 instead, use Nz around the aggregate expression, such as Nz(Avg(IIf([ValueField] <> 0, [ValueField], Null)), 0).
Can I exclude zeros from the average but keep those records in other totals?
Yes. Add Avg(IIf([ValueField] <> 0, [ValueField], Null)) to the query instead of filtering zeros in the WHERE clause. Other aggregates can then still use the zero-value records.
How can I calculate the same average in a spreadsheet?
In WPS Spreadsheets or Excel, enter =AVERAGEIF(A2:A100,"<>0") and adjust the range to match your data. The formula averages nonzero numeric values.




