Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: An Average that Excludes Zero Values.
by Allen Wyatt
(last updated December 17, 2018)
Veronica knows how to use the AVERAGE function to determine the average of a range of values. She would like to have the average determined based on the non-zero values in the range, however.
There are several ways you can approach this problem. The first is to remember how an average is calculated. It is defined as the sum of a range of values divided by the number of items in the range. Thus, you could figure the exclusionary average by simply making sure that the denominator (the number you are dividing by) does not include any zero values. For instance:
This approach uses the COUNTIF function to determine the number of cells in the range (A1:A50) that don't contain zero. If this range contains not only zeros but also blank cells, and you don't want the blank cells figured into the result, then you need to use a more complex formula:
The COUNTIF function counts cells that do not explicitly evaluate to 0, but it will count blank and text cells. The COUNTBLANK term adjusts for the blank cells and the difference between COUNTA and COUNT adjusts the total count for cells that contain text.
Of course you can also use an array formula to do your calculation:
Remember that array formulas need to be entered by using the combination Ctrl+Shift+Enter. This array formula also excludes blanks or cells containing text.
ExcelTips is your source for cost-effective Microsoft Excel training. This tip (7727) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: An Average that Excludes Zero Values.
Create Custom Apps with VBA! Discover how to extend the capabilities of Office 2013 (Word, Excel, PowerPoint, Outlook, and Access) with VBA programming, using it for writing macros, automating Office applications, and creating custom applications. Check out Mastering VBA for Office 2013 today!
When you need to count a number of cells based upon a single criteria, the standard function to use is COUNTIF. This tip ...Discover More
When you are working with sequenced values in a list, you'll often want to take some action based on the top X or bottom ...Discover More
One of the areas in which Excel provides worksheet functions is in the arena of statistical analysis. You may want to ...Discover More
FREE SERVICE: Get tips like this every week in ExcelTips, a free productivity newsletter. Enter your address and click "Subscribe."
Got a version of Excel that uses the menu interface (Excel 97, Excel 2000, Excel 2002, or Excel 2003)? This site is for you! If you use a later version of Excel, visit our ExcelTips site focusing on the ribbon interface.