#DIV/0! error how to fix

shellt

New Member
Joined
Aug 3, 2010
Messages
6
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

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.

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,339
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
Would this help
Code:
=SUM(H99:H111)/COUNTIF(H99:H111,">0")
 

Mr_Roscoe

Board Regular
Joined
Mar 28, 2006
Messages
200
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
Joined
Oct 27, 2005
Messages
20,339
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows

ADVERTISEMENT

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
 

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,203
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
Joined
Aug 3, 2010
Messages
6

ADVERTISEMENT

Hi All,

I've fixed it - the formula below worked.

Thanks all for your help.

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

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,203
Hi All,

I've fixed it - the formula below worked.

Thanks all for your help.

=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)
 

shellt

New Member
Joined
Aug 3, 2010
Messages
6
Thanks - but I already had the formula I had before getting the other reply.
 

Watch MrExcel Video

Forum statistics

Threads
1,132,679
Messages
5,654,713
Members
418,149
Latest member
tjanok

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Top