# Calculate an average percentage with IF

#### leopardhawk

##### Well-known Member
Using Excel 2007, is there a simple formula to calculate the average percentage excluding any cells that are 0%?

Cells K5 through K22 have student percentages in each row based on test scores across multiple columns. I need cell K1 to calculate the class average which it does using this formula:

=AVERAGE(K5:K22)

The problem is that the class size is never the same and if there are less than 18 students, some of the cells in column K will have 0% in them which then throws off the class average in cell K1.

I need a formula that will only calculate the percentages if they are more than 0%.

### Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

#### barry houdini

##### MrExcel MVP
Try AVERAGEIF like this

=AVERAGEIF(K5:K22,">0")

#### leopardhawk

##### Well-known Member
Thanks Barry, that worked perfectly...!!

Replies
9
Views
264
Replies
2
Views
481
Replies
5
Views
101
Replies
1
Views
103
Replies
1
Views
30

1,130,119
Messages
5,640,218
Members
417,131
Latest member
Seanr19871

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