# How to set up a formula using the average and if functions

#### penguinT

##### New Member
I am trying to do a simple formula where I want to average a row of percentages without it counting the zeros. I thought that if I had it AVERAGEIF all numbers were greater than 0 it would work. For some reason, I cannot make it work for me. Some of the cells in the row are linked to other worksheets which fills the cell with text data. Does this have something to do with it not working? I get either a NAME error or VALUE error. I have tried turning off the zero in the options menu; that doesn't help either. Please help. Thank you in advance. penguinT

### Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Book2
ABCDEFGHI
143.571429
20
34
42
55
64
71
80
95
100
11
12
Sheet1

Hello penguinT.

Lets us assume, that Your data is on area B2:B9. Use Formula:

=AVERAGE(IF(B2:B9<>0,B2:B9))

When You write this formula, do not push Enter, but instead CTRL + SHIFT + ENTER. Excel adds in beginning { and at end }. So You need ARRAY Formula.

Hopes this helps You.

BRGDS Sir Vili.

Let A1:A10 be the range of interest.

The following ordinary formula

=SUM(A1:A10)/MAX(1,COUNT(A1:A10)-COUNTIF(A1:A10,0))

will also give you the desired average.

On 2002-09-19 09:37, Sir Vili wrote:
...Use Formula:

=AVERAGE(IF(B2:B9<>0,B2:B9))

Since the IF worksheet functions treats 0 values as FALSE there's no need to compare each value to 0.

Replies
2
Views
616
Replies
3
Views
157
Replies
4
Views
199
Replies
2
Views
190
Replies
7
Views
116

1,220,010
Messages
6,151,443
Members
451,028
Latest member
greekness1

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