# #DIV/0! error how to fix

#### shellt

##### New Member
Hi,

I have a formula

=AVERAGEIF(H99:H111,">0",H99:H111)

Some of the answers are returning the error #DIV/0! due to there being no figures in what is being averaged, however it is a big table and I don't want to have to do individual formula's to get rid of the error.

How can I get rid of the error, while still making this formula work?

Cheers,

### Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

#### Michael M

##### Well-known Member
Would this help
Code:
``=SUM(H99:H111)/COUNTIF(H99:H111,">0")``

#### shellt

##### New Member
Hi,

I tried that but I get the same error.

#### Mr_Roscoe

##### Board Regular
shellt - not sure exactly what you mean, here are 2 answers.

perhaps do a search and replace where there are no figures with a zero (Find blank and replace with 0, matching entire cell contents)

or modify the formula so that if it is an error it does not display the #DIV/0! result :
=IF(ISERROR(AVERAGEIF(H99:H111,">0",H99:H111)),"",AVERAGEIF(H99:H111,">0",H99:H111))

trust this helps, Ian R.

#### Michael M

##### Well-known Member
So are you saying the DIV error is further up the table and this is the formula at the bottom ??
If so, what formula are you using that creates the DIV error

##### MrExcel MVP
Hi,

I have a formula

=AVERAGEIF(H99:H111,">0",H99:H111)

Some of the answers are returning the error #DIV/0! due to there being no figures in what is being averaged, however it is a big table and I don't want to have to do individual formula's to get rid of the error.

How can I get rid of the error, while still making this formula work?

Cheers,

Try...

=IFERROR(AVERAGEIF(H99:H111,">0",H99:H111),"")

#### shellt

##### New Member
Hi All,

I've fixed it - the formula below worked.

=IF(ISERROR(AVERAGEIF(D5:D17,">0",D5:D17)),0,(AVERAGEIF(D5:D17,">0",D5:D17)))

##### MrExcel MVP
Hi All,

I've fixed it - the formula below worked.

=IF(ISERROR(AVERAGEIF(D5:D17,">0",D5:D17)),0,(AVERAGEIF(D5:D17,">0",D5:D17)))

Try to pay attention to help that is already provided. Since you have AVERAGEIF, you also must have IFERROR on you system. The following avoids computing the same thing twice:

=IFERROR(AVERAGEIF(D5:D17,">0",D5:D17),0)

Replies
5
Views
449
Replies
4
Views
384
Replies
3
Views
379
Replies
4
Views
749
Replies
3
Views
301

1,171,186
Messages
5,874,243
Members
433,041
Latest member
spongeavenger

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