MrExcel Publishing
Your One Stop for Excel Tips & Solutions


Posted by Tanya on October 04, 2001 9:48 AM

Is there a way to do a function to take the average of only the cells that have a number in it? I have a select group of cells, and every week different cells in this group may be zero. I only want to include the cell in the average if it's not zero. Can you do a selective average like this in a formula?

Posted by Barrie Davidson on October 04, 2001 10:00 AM

Tanya, you could try (assumes your data is in A1:A4)


BarrieBarrie Davidson

Posted by Aladin Akyurek on October 04, 2001 10:37 AM



If you only expects blank cells, zeroes, and positive numbers, change <> to >.



Posted by IML on October 04, 2001 10:41 AM

Barrie's formula is the way to go if you don't have any blank cells in your range.
If you do and want to exlude them, you may want to consider using an array formula (hit enter while control and shift are depressed),such as

They will return the same numbers with a data set of
but will be different with

good luck

Posted by Barrie Davidson on October 04, 2001 10:41 AM

Nice touch

Great idea using the MAX function in the denominator!


Posted by IML on October 04, 2001 10:43 AM

Problem 1: I pasted the wrong formula. I meant to past

Problem 2: Use Aladin's formula. It is alway preferable to avoid using array formula if not necessary.