# average without zeros

#### Fyr

##### Active Member
I'm using this formula:
=AVERAGE(C4,E4,G4,I4,K4,M4)

It a cell contains zero's, it does not average it right.
How can I use the above code to ignore zeros?

### Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

##### MrExcel MVP
I'm using this formula:
=AVERAGE(C4,E4,G4,I4,K4,M4)

It a cell contains zero's, it does not average it right.
How can I use the above code to ignore zeros?

If the relevant cells are supposed to house numbers >= 0, then:

=SUM(C4,E4,G4,I4,K4,M4)/INDEX(FREQUENCY((C4,E4,G4,I4,K4,M4),{0}),2)

#### Fyr

##### Active Member
thank you!!
that solved my problem!

#### stanleydgromjr

##### Banned
Fyr,

But, this also works:
=SUM(SUMIF(INDIRECT({"C4","E4","G4","I4","K4","M4"}),">0"))/INDEX(FREQUENCY((C4,E4,G4,I4,K4,M4),0),2)

Have a great day,
Stan

#### ZVI

##### MrExcel MVP
For positive/negative excluding zero/empty/error values, array formula:
{=AVERAGE(IF((MOD(COLUMN(C4:M4)-COLUMN(C4),2)=0)*ISNUMBER(1/C4:M4),C4:M4))}

Last edited:

#### ZVI

##### MrExcel MVP
For positive/negative excluding zero/empty/error values, array formula:
{=AVERAGE(IF((MOD(COLUMN(C4:M4)-COLUMN(C4),2)=0)*ISNUMBER(1/C4:M4),C4:M4))}
The same, but a little bit simpler (array formula):
{=AVERAGE(IF({1,0,1,0,1,0,1,0,1,0,1}*ISNUMBER(1/C4:M4),C4:M4))}

##### MrExcel MVP
For positive/negative excluding zero/empty/error values, array formula:
{=AVERAGE(IF((MOD(COLUMN(C4:M4)-COLUMN(C4),2)=0)*ISNUMBER(1/C4:M4),C4:M4))}

Control+shift+enter:
Code:
``````=AVERAGE(
IF(MOD(COLUMN(C4:M4)-COLUMN(C4),2)=0,
IF(ISNUMBER(C4:M4),
IF(C4:M4 > 0,
C4:M4))))``````

which is an expensive piece formula for a set of 6 cells.

BTW, the matchematicians dislike the idea of exluding 0's if the data set is something like:

3,-3,0,2,1

although either an average of figures > 0 or < 0 is readily accepted.

Replies
5
Views
197
Replies
7
Views
457
Replies
10
Views
328
Replies
3
Views
244
Replies
5
Views
216

1,195,650
Messages
6,010,915
Members
441,572
Latest member
keobongda8812

### 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.

### Which adblocker are you using?

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

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