If statement to get rid of errors (#DIV/0!)

lcohenvb

New Member
Joined
Oct 27, 2002
Messages
44
I can't remember how to write an if statement to put a 0 in a cell if it can't be divided by 0. The statement so far is:

=+(BK41-BL41)/BL41

All I want is either the result of the calculation or a 0 but of course, when the number can't be divided, I get #DIV/0!. Can anyone tell me the correct syntax for the if statement to avoid this.

Sorry, i know this is a simple question but I'm not a very sophisticated user.

Thanks for your help!
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
Hi there

You can try the IsError function:

If(IsError(your formula),0,your formula)

regards

Derek
 
Upvote 0
Try this:
=IF(ISERR(+(BK41-BL41)/BL41),0,+(BK41-BL41)/BL41)
Dan
(Edit: I see Derek beat me to it...(again :LOL: )
 
Upvote 0
You don't really need iserror for this.

=If(BL41,(BK41-BL41)/BL41,0)


If(Denominator,Numerator/Denominator,0)
 
Upvote 0
If you are only interested in DIV/0 errors, then a simple:

=if(BL41=0,0,(BK41-BL41)/BL41)

will do.

This will then highlight other errors.
 
Upvote 0

Forum statistics

Threads
1,214,806
Messages
6,121,672
Members
449,045
Latest member
Marcus05

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
Back
Top