ignoring zero values in calculations

Kourada

New Member
Joined
Apr 8, 2002
Messages
17
I cells A1:A3 I have the numbers 5,0,5 respectivly. In Cell A4, I have the formula Average(A1:A3). I want the zero value to be ignored in the calculation, so that the result of the average is "5". Data is continuously added to the spreadsheet, and I never know which of the cells will have a zero value, so just averaging cells A1 and A3 is not an option.

Any ideas?
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
=SUM(A1:A3)/COUNTIF(A1:A3,"<>0")

Try:

{0;0;0}

which are real 0's.


Hi Aladin:

the following modification will take care of concern about the possibility of all 0s as well.

=IF(SUM(A1:A3)=0,0,(SUM(A1:A3)/COUNTIF(A1:A3,"<>0")))

Regards!
This message was edited by Yogi Anand on 2002-05-12 17:23
 
Upvote 0

Forum statistics

Threads
1,214,813
Messages
6,121,706
Members
449,049
Latest member
THMarana

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top