# #DIV/0! Error

#### paul29berks

##### Active Member
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
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
Try using the isserror function.

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

#### paul29berks

##### Active Member
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
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))))

Replies
3
Views
209
Replies
6
Views
281
Replies
3
Views
831
Replies
1
Views
127
Replies
3
Views
189

### Forum statistics

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.

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