If statement problem - #div/0!

jgold20

Board Regular
Joined
Feb 4, 2018
Messages
135
Cubic feet Filing or Scheduling & CC FeesMinimum MoveCompany CodeEnter Minimum Move Amount Minimum [FONT=&quot]Price [/FONT]per[FONT=&quot]CF [/FONT]
YESYESL500#DIV/0!
N #DIV/0!
NO #DIV/0!
#DIV/0!

<colgroup><col width="91" style="width: 68pt;"><col width="99" style="width: 74pt;"><col width="89" style="width: 67pt;"><col width="99" style="width: 74pt;"><col width="123" style="width: 92pt;"><col width="97" style="width: 73pt;"></colgroup><tbody>
</tbody>
In the above example, when cubic feet is 0, it returns a #div/0! error. The statement I am using is =IF(G3="YES",(I3/E3),0) for minimum move. If I use the drop down and change minimum move to NO, it returns a 0. I have tried everything I could think of and still receive the #div/0!. Is there any way to avoid the error. I understand why it is happening
 
Or in your later scenario:
Code:
=IF($M$3=0,"",IF(O3="YES",Q3/$M$3,0))

Personally, I like to zero in on the specific cause for the error (division by zero) instead of using IFERROR, when possible, as IFERROR will catch/sweep/hide other errors too, and you may want to know about those.
 
Last edited:
Upvote 0

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
lets start again, what are you expecting in R4 to R6?


Excel 2013/2016
MNOPQR
2Cubic feetFiling or Scheduling & CC FeesMinimum MoveCompany CodeEnter Minimum Move AmountMinimumPriceperCF
3200YESYESH$400.00$2.00
4L$1,200.00?
5N$1,111.00?
6R$1,200.00?
Sheet4
 
Upvote 0
My mistake #9 , I used your solution. I have another question, how can I populate a 2nd cell with the result of the if statement? I cannot put a formula in the 2nd cell, in case G3=NO, then I have to manually enter a number
 
Upvote 0
how can I populate a 2nd cell with the result of the if statement? I cannot put a formula in the 2nd cell, in case G3=NO, then I have to manually enter a number
Formulas can only return values to the cell they reside in. They cannot return values to other cells.
Any cell can either have a formula or a hard-coded value, but never BOTH at the same time.
What you want to do will require VBA. Are you open to a VBA solution?
 
Last edited:
Upvote 0
We may be able to use a Worksheet_Change event procedure, which is code that runs automatically when a certain range is manually updated.

What cells is being manually updated to trigger this whole process to run?
What column is your formula in?
What is the second column that you would like the value copied into?
 
Upvote 0
2) Formula - J3 - J6
3) Second column - E9 - E12
So, is the relationship between the two such J3 maps to E9, J4 mapes to E10, etc?
 
Upvote 0

Forum statistics

Threads
1,215,516
Messages
6,125,285
Members
449,218
Latest member
Excel Master

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