Archive of Mr Excel Message Board


Back to Forms in Excel VBA archive index
Back to archive home

divide by zero

Posted by gordon on July 30, 2001 5:04 PM
How do I trick the computer into dividing by zero. I need the zero because it has a value in my program.
I tried to replace #DIV/0! with 0 using the find and replace but Excel won't let me.

Check out our Excel Resources

Re: divide by zero - use IF & ISERROR

Posted by anno on July 30, 2001 5:20 PM

Not sure if this is what you want, but a quick and dirty way around this is to replace the #DIV/0! with a zero by using ISERROR(). For example, if the operation you have in cell A1 returns #DIV/0!, change the contents of A1 to "=IF(ISERROR(*),0)", where * is the operation you currently have in A1.
If you have a whole bunch of these to change in a non contiguous range this method will be a bit tedious, but like i said it's a quick and dirty way. over to the experts.

Re: divide by zero

Posted by Aladin Akyurek on July 30, 2001 5:21 PM

You can't as far as I know.

:I need the zero because it has a value in my program.

Look at the formulas that return #DIV/0 and modify them to return 0. For example,

=IF(B1, A1/B1,0)

This will return 0 instead #DIV/0 when B1=0.

Aladin


=IF


This archive is from the original message board at www.MrExcel.com.
All contents © 1998-2004 MrExcel.com.
Visit our online store to buy searchable CD's with thousands of VBA and Excel answers.
Microsoft Excel is a registered trademark of the Microsoft Corporation.
MrExcel is a registered trademark of Tickling Keys, Inc.