Home » excel » Omit specific values from a named range in Excel

Omit specific values from a named range in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

I have a named range that is made up of dynamic values of which I need to omit the zeros prior to averaging. How would I go about doing this?

myRange = (1,3,4,0,4,3,5,0,1)
AVERAGE(myRange) equals 2.333

So when I run =AVERAGE(myRange) I am not getting the intended results.

What I would like is to remove the zeroes so I end up with the following:

noZeroes(myRange) = (1,3,4,4,3,5,1)
AVERAGE(myRange) equals 3

Any suggestions?

How to&Answers:

Use this formula to average all of the non-zero values in a range:

=SUM(myRange)/COUNTIF(myRange,"<>0")

Answer:

You can use AVERAGEIF(range,criteria,average_range) in Excel 2007

Range is one or more cells to average, including numbers or names, arrays, or references that contain numbers.

Criteria is the criteria in the form of a number, expression, cell reference, or text that defines which cells are averaged. For example, criteria can be expressed as 32, “32”, “>32”, “apples”, or B4.

Average_range is the actual set of cells to average. If omitted, range is used.

Your Solution:

=AVERAGEIF(myRange,">0") = 3

OR

=AVERAGEIF(myRange,"<>0") = 3