#DIV/0! Error

paul29berks

Active Member
Joined
Mar 15, 2004
Messages
293
I have this formula:

=IF(AND($D$174=0,$Z$174=0),CG$174*($Z$169+$AP$169)/($Z$174+$AP$174),IF(AS$174=0,CG$174*($BN$169+$CD$169)/($BN$174+$CD$174),CG$174*($BN$169/$BN$174)))

However there are instances where I am dividing by 0 and receive the following error - does anyone know how I can prevent this by building into this formula?

Thanks
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Jon von der Heyden

MrExcel MVP, Moderator
Joined
Apr 6, 2004
Messages
10,868
Office Version
  1. 365
Platform
  1. Windows
Code:
=IF(ISERROR(IF(AND($D$174=0,$Z$174=0),CG$174*($Z$169+$AP$169)/($Z$174+$AP$174),IF(AS$174=0,CG$174*($BN$169+$CD$169)/($BN$174+$CD$174),CG$174*($BN$169/$BN$174)))),0,IF(AND($D$174=0,$Z$174=0),CG$174*($Z$169+$AP$169)/($Z$174+$AP$174),IF(AS$174=0,CG$174*($BN$169+$CD$169)/($BN$174+$CD$174),CG$174*($BN$169/$BN$174))))
 

WernerLouw

Board Regular
Joined
Dec 9, 2004
Messages
93
Try using the isserror function.


=IF(ISERROR((your formula here)),"",(your formula here))

it is easy if you use the ASAP utiities add-in you can get it on the recommended add-ins section.
 

paul29berks

Active Member
Joined
Mar 15, 2004
Messages
293
Sorry to be a pain have included as:

IF(ISERROR((IF(AND($D$14=0,$Z$14=0),CF$14*($Z9+$AP9)/($Z$14+$AP$14)),"",(IF(AR$14=0,CF$14*($BN9+$CD9)/($BN$14+$CD$14),CF$14*($BN9/$BN$14))

but unaccepted. Can you help?
 

Fergus

Well-known Member
Joined
Mar 10, 2004
Messages
1,174
Hi Paul,

=IF(ISERROR(IF(AND($D$14=0,$Z$14=0),CF$14*($Z9+$AP9)/($Z$14+$AP$14),IF(AR$14=0,CF$14*($BN9+$CD9)/($BN$14+$CD$14),CF$14*($BN9/$BN$14)))),"",IF(AND($D$14=0,$Z$14=0),CF$14*($Z9+$AP9)/($Z$14+$AP$14),IF(AR$14=0,CF$14*($BN9+$CD9)/($BN$14+$CD$14),CF$14*($BN9/$BN$14))))

But see also : http://www.mrexcel.com/board2/viewtopic.php?t=126320
 

Forum statistics

Threads
1,148,215
Messages
5,745,424
Members
423,951
Latest member
peggrif

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