# #DIV/0! error message

#### Shelly68

##### Board Regular
I'm trying to calculate a formula that is trying to divide a cell that is ZERO, what is the formula I put in to make it appear as a Zero answer instead of the above (sorry that looks all muddled to me)

### Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
=IF(X1=0,0,formula)

where X1 is the cell that you are dividing by that may house a zero.

enter your formula in the formula place

sorry you just beat me, I figured I should probably put the formula in that I'm talking about (I did a search and saw that others had as well).

H23/(G23*\$J\$1)*G23

where H23 equals zero, (as a result of another formula)
G23 equals zero, (as a result of another formula)
and J1 equals 152

this is showing up as #DIV/0!

Does that make it easier to understand what I'm trying to say

I'm trying to calculate a formula that is trying to divide a cell that is ZERO...
But later, you wrote,
H23/(G23*\$J\$1)*G23

where H23 equals zero, (as a result of another formula)
G23 equals zero, (as a result of another formula)
and J1 equals 152

this is showing up as #DIV/0!
The error you are getting is not caused by "trying to divide a cell that is ZERO" (that is, cell H23). That will return a 0, not an error. The error you are getting is because you are dividing by zero (that is, cell G23). It's okay if H23 is zero, but not that G23 is zero.

The suggestion that NBVC gave will work as far as not giving you an error (substitute G23 for X1), but realize that it violates mathematical rules. Dividing by zero isn't zero, and in fact is more like infinity (the smaller the number you divide by, the larger the answer).

This would be more correct: =IF(G23=0,"Undefined",H23/(G23*\$J\$1)*G23)

Okay I tried that but it's now giving an answer of undefined, (which does not work either because I'm adding these elsewhere later on).

Is it not possible just to have it say 0??

Okay I tried that but it's now giving an answer of undefined, (which does not work either because I'm adding these elsewhere later on).

Is it not possible just to have it say 0??

=IF(N(G23*\$J\$1),H23/(G23*\$J\$1)*G23,0)

Okay I tried that but it's now giving an answer of undefined, (which does not work either because I'm adding these elsewhere later on).

Is it not possible just to have it say 0??

Yes it is:

=IF(G23=0,0,H23/(G23*\$J\$1)*G23)

Thank you everybody concerned for your help.

It works and makes life a heck of a lot easier,

thanks again!!!!

Replies
2
Views
563
Replies
1
Views
609
Replies
2
Views
86
Replies
4
Views
411
Replies
11
Views
844

1,218,576
Messages
6,143,315
Members
450,477
Latest member
teresab543

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