ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   how do I get AVERAGE to ingore a zero value cell (https://www.excelbanter.com/excel-worksheet-functions/9651-how-do-i-get-average-ingore-zero-value-cell.html)

Mikewoodmsw

how do I get AVERAGE to ingore a zero value cell
 
I am using the AVERAGE function but if i have two cells where one is "0" how
do I get it to preserve the first value rather than halving it?
E.G
what I need it to do is:
3+3 = 6, average score = 3
5+0 = 5 average score = 5

Jason Morin

One way:

=SUM(A1:A10)/COUNTIF(A1:A10,"<0")

If it's possible that text values are found in your range,
use:

=SUM(A1:A10)/SUM(COUNTIF(A1:A10,"<0"),-COUNTIF
(A1:A10,"*"))

This following is also valid, but longer:

=SUM(A1:A10)/-(COUNTA(A1:A10)-SUM(COUNTIF(A1:A10,
{"<0","<=9.99999999999999E+307"})))

HTH
Jason
Atlanta, GA

-----Original Message-----
I am using the AVERAGE function but if i have two cells

where one is "0" how
do I get it to preserve the first value rather than

halving it?
E.G
what I need it to do is:
3+3 = 6, average score = 3
5+0 = 5 average score = 5
.


Gord Dibben

Mike

Type =AVERAGE(IF(A1:A10<0,A1:A10)) into a cell.

This is an array formula

Enter using CTRL + SHIFT + ENTER and Excel will place curly brackets around
like this.

{=AVERAGE(IF(A1:A10<0,A1:A10))}


Gord Dibben Excel MVP


On Sat, 22 Jan 2005 10:07:06 -0800, "Mikewoodmsw"
wrote:

I am using the AVERAGE function but if i have two cells where one is "0" how
do I get it to preserve the first value rather than halving it?
E.G
what I need it to do is:
3+3 = 6, average score = 3
5+0 = 5 average score = 5




All times are GMT +1. The time now is 06:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com