If statement problem - #div/0!

jgold20

Board Regular
Joined
Feb 4, 2018
Messages
135
[TABLE="width: 598"]
<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>[TR]
[TD="class: xl68, width: 91, align: center"]Cubic feet[/TD]
[TD="class: xl73, width: 99, align: center"] Filing or Scheduling & CC Fees[/TD]
[TD="class: xl71, width: 89, align: center"]Minimum Move[/TD]
[TD="class: xl73, width: 99, align: center"]Company Code[/TD]
[TD="class: xl73, width: 123, align: center"]Enter Minimum Move Amount [/TD]
[TD="class: xl75, width: 97, align: center"]Minimum [FONT=&quot]Price [/FONT]per[FONT=&quot]CF [/FONT][/TD]
[/TR]
[TR]
[TD="class: xl69, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"] [/TD]
[TD="class: xl70, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"]YES[/TD]
[TD="class: xl72, width: 89, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"]YES[/TD]
[TD="class: xl76, width: 99, align: center"]L[/TD]
[TD="class: xl74, width: 123, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"]500[/TD]
[TD="class: xl77, align: center"]#DIV/0![/TD]
[/TR]
[TR]
[TD="class: xl66, align: center"][/TD]
[TD="class: xl67"][/TD]
[TD="class: xl66, align: center"][/TD]
[TD="class: xl76, width: 99, align: center"]N[/TD]
[TD="class: xl74, width: 123, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"] [/TD]
[TD="class: xl77, align: center"]#DIV/0![/TD]
[/TR]
[TR]
[TD="class: xl65"][/TD]
[TD="class: xl64"][/TD]
[TD="class: xl66, align: center"][/TD]
[TD="class: xl76, width: 99, align: center"]NO[/TD]
[TD="class: xl74, width: 123, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"] [/TD]
[TD="class: xl77, align: center"]#DIV/0![/TD]
[/TR]
[TR]
[TD="class: xl65"][/TD]
[TD="class: xl64"][/TD]
[TD="class: xl66, align: center"][/TD]
[TD="class: xl76, width: 99, align: center"] [/TD]
[TD="class: xl74, width: 123, bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=ACB9CA]#ACB9CA[/URL] , align: center"] [/TD]
[TD="class: xl77, align: center"]#DIV/0![/TD]
[/TR]
</tbody>[/TABLE]
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,224,823
Messages
6,181,183
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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