An Average that Excludes Zero Values

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.

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:

```=SUM(A1:A50)/COUNTIF(A1:A50,"<>0")
```

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:

```=SUM(A1:A50)/(COUNTIF(A1:A50,"<>0")-COUNTBLANK(A1:A50)-
(COUNTA(A1:A50)-COUNT(A1:A50)))
```

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:

```=AVERAGE(IF(A1:A50<>0,A1:A50))
```

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.

Related Tips:

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!

 *Name: Email: Notify me about new comments ONLY FOR THIS TIP Notify me about new comments ANYWHERE ON THIS SITE Hide my email address *Text: *What is 5+3 (To prevent automated submissions and spam.)

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)

Our Company

Sharon Parq Associates, Inc.

Our Sites

Tips.Net

Beauty and Style

Cars

Cleaning

Cooking

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)

Gardening

Health

Home Improvement

Money and Finances

Organizing

Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net