Excel has special functions to calculate the average of the number in a range of cells and also calculate the average of cells based on specified criteria, like AVERAGE and AVERAGEIF functions. But there are situations where cells in a range are Blank or may contain zeros, so it may affect the result. So you need to take Excel average without zeros and average if not blank. In this case, you need to use AVERAGEIF function to average cells based on criteria.
The AVERAGEIF function in Excel
AVERAGEIF function averages cells based on supplied criteria in Excel as per its syntax. The syntax of AVERAGEIF function is as follows;
=AVERAGEIF (range, criteria, [average_range])
range – This argument contains the range of cells on which criteria are tested.
criteria – This argument contains the condition to determine which cells to average. It may contain numeric or text values, a logical expression, cell reference or other functions as the condition to meet.
average_range – This argument consists of the range of cells that contain numbers you want to average. It is the optional argument and if you omit this argument in function then function averages cells given in range argument.
Ignore zeros when finding the average
In this case, as you need to average ignoring zeros in a range argument, so you do not need to supply average_range argument in the AVERAGEIF function here. You need to supply only range argument and criteria argument to find the average.
In the criteria argument, you need to test the criteria “Not Equal to Zero”. This is done by using logical expression Not Equal To (<>) with Zero, enclosed in double quotation marks (“”).
Ignore Blanks When Finding the Average
Remember that like AVERAGE function, AVERAGEIF function automatically ignores Blank cells and cells containing text values. So you do not need to make any special arrangements to average ignoring blanks and text values in the range. But where cells contain zeros, you need to use AVERAGEIF function based on criteria “Not Equal to Zero.”
In this example you need Excel average ignoring Zeros and Blank cells and how it is different from the simple average of these cells. Suppose you have a range of cells A1:A11 that contains numbers, zeros, and blank cells. By using the AVERAGEIF function with criteria expression Not Equal to Zero (“<>0”) you will average cells ignoring zero and Blank values. The formula, in this case, would be;
This formula eliminates zero values as a result of the criteria expression and Blank cells as default functionality of AVERAGEIF function, so it only counts cells in Excel average without zeros and average if not blank.
As you are aware that AVERAGE function by default ignores Blank cells, but it does not ignore zeros, so that why its result is different from the AVERAGEIF function ignoring zeros and blanks. You can see the difference of results by averaging the same range of values A1:A11 as a result of these two functions, such as;
Still need some help with Excel formatting or have other questions about Excel? Connect with a live Excel expert here for some 1 on 1 help. Your first session is always free.