**Please Note: **
This article is written for users of the following Microsoft Excel versions: 2007 and 2010. If you are using an earlier version (Excel 2003 or earlier), *this tip may not work for you*. For a version of this tip written specifically for earlier 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.

The worksheet function most suited to this purpose is to use AVERAGEIF. You can use it in this manner:

=AVERAGEIF(A1:A50,">0")

This function only includes in the average those cells that contain values greater than zero. If you want to also exclude blank cells, you should use the AVERAGEIFS function. This function differs from AVERAGEIF in that it allows you to specify multiple criteria that indicate which cells to average.

=AVERAGEIFS(A1:A50,A1:A50,">0",A1:A50,"<>""")

Of course, if you want to approach the problem "old school" (without using AVERAGEIF or AVERAGEIFS), then there are several ways you can proceed. 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.

All in all it is easier to use the AVERAGEIF or AVERAGEIFS functions. When would you not want to use them? When you need to share your workbook with users of Excel versions prior to Excel 2007. (This is when the functions were added to Excel.)

*ExcelTips* is your source for cost-effective Microsoft Excel training.
This tip (7729) applies to Microsoft Excel 2007 and 2010. You can find a version of this tip for the older menu interface of Excel here: **An Average that Excludes Zero Values**.

**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!

Figuring out how to average data that is in a contiguous range of cells is easy. When the data is spread over a group of ...

Discover MoreA moving average can be a great way to analyze a series of data points that you've collected over time. Setting up a formula ...

Discover MoreNeed to calculate a running average for the last twelve values in a constantly changing range of values? The formula ...

Discover More**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

2016-08-28 11:39:11

Larry K. Binning

thanks

Larry

2016-06-11 05:45:58

Michael (Micky) Avidan

It sounds as if your calculation have changed from "Automatic" to "manual".

(Check it according to your Excel version)

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

2016-06-10 09:11:40

Wendi

2016-05-24 11:04:34

Willy Vanhaelen

Look in Excel's Help and you will find: "If a range or cell reference argument contains text, logical values, or empty cells, those values are ignored; however, cells with the value zero are included."

So you have to do nothing special because what you want is simply the default.

2016-05-23 22:56:09

Sharyn Kingston

2016-05-18 08:45:52

Karen

Thanks!

2016-05-04 05:31:33

Michael (Micky) Avidan

@SAKILARANI,

The AVERAGE Function discards empty cells - so there is no problme for the manager to leave them empty.

Take a look at the picture.

(see Figure 1 below)

--------------------------

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2016)

ISRAEL

**Figure 1.**

2016-05-04 01:16:29

SAKILARANI

2016-02-25 01:28:17

veeranjaneyulu

=IF(Mapping!R6="",0,AVERAGE(D32:D46))

2015-10-12 13:07:26

Gino

http://excelribbon.tips.net/T007845_Averaging_a_Non-Contiguous_Range.html

2015-10-12 12:47:28

Gino

I have a similar situation as Todd

2015-09-17 18:00:57

Todd

2015-08-29 10:06:42

shahab

Thanks a lot.

2015-07-23 07:13:58

Michael (Micky) Avidan

In your example it should read:

=AVERAGEIF(A1:A50,"<>0",A1:A50)

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

2015-07-23 07:12:45

Michael (Micky) Avidan

This tip was intended for 2003 and eralier versions users.

However, starting with Excel 2007 - the following formula will achieve the same task without the need for an ampersand.

By the way - the following formula takes into calculation also negative values, therefor I used: "<>0".

=AVERAGEIF(A1:A11,"<>0",A1:A11)

Michael (Micky) Avidan

“Microsoft® Answers" - Wiki author & Forums Moderator

“Microsoft®” MVP – Excel (2009-2015)

ISRAEL

2015-07-22 10:33:03

Ben

=AVERAGEIFS(A1:A50,A1:A50,">0",A1:A50,"<>""")

is changed to

=AVERAGEIFS(A1:A50,A1:A50,">0",A1:A50,"<>"&"")

Notice the ampersand in the fourth to last character.

2015-04-12 04:19:13

Kate

I have a range of cells (M9:M18)that have one of three quantities: 100, 50, 0.

These quantities are filled in based on the formula used in the cell to the left of them.

I need to use a formula to come up with an average for these cells and have had no luck with all of the threads I've tried.

Help!

2015-03-01 10:20:36

alec macleod

2015-02-05 12:47:06

Cathy

2014-12-23 06:40:29

Gary

Great tips!

The current AverageIf forumla works well for me. But the problem is it's counting all the Zero's in my data. Are you able to provide guidance on how i add into this formula the exclusion of Zero's?

=AVERAGEIF('YTD PPV - 410'!$A:$A,'Aus - YTD @ Standard'!$B$54&'Aus - YTD @ Standard'!B55,'YTD PPV - 410'!$P:$P)

Many thanks

2014-11-24 14:20:45

Brian

=AVERAGEIF(A1:A50,">0")

does not do what Veronica wants since there may be negative values in the range. She should instead use:

=AVERAGEIF(A1:A50,"<>0")

2014-11-11 02:06:06

Ricardo A. Reyes

2014-10-14 04:27:17

George

Very well explained, thank you !

2013-04-28 01:14:24

Gaëtane

Thank you, well explained !

2013-04-24 16:29:19

Jamie

First tutorial I found that actually works, went through about 3-4 others.

Thanks,J

2013-03-06 16:55:17

André Terra

Thanks! First hit on google for "average excluding ifs" ;)

Got a version of Excel that uses the
ribbon interface (Excel 2007 or later)?
**This site is for you!** If you
use an earlier version of Excel, visit
our *ExcelTips* site focusing on the menu interface.

**FREE SERVICE:** Get tips like this every week in *ExcelTips,* a free productivity newsletter. Enter your address and click "Subscribe."

Copyright © 2017 Sharon Parq Associates, Inc.

## Comments