ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Can I turn off 0 divide error, for denominator = 0 (https://www.excelbanter.com/excel-discussion-misc-queries/171022-can-i-turn-off-0-divide-error-denominator-%3D-0-a.html)

[email protected]

Can I turn off 0 divide error, for denominator = 0
 
I have a macro with many divisions, for many
of the divisions both the numerator and denominator are zero.
It's the no data case, so it's 0/0 for that condition
(or else it's a fraction).
Office 2007, integer dimensioned values.
If denominator = 0 then denominator = 1
will get round it since it's then 0/1 and still equates
to 0.
But doing this comparison a million or so
times is clearly time consuming and inefficient.
With the current database, and growing, it's approx
5M divide by 0 tests.
Any suggestions?

Gary''s Student

Can I turn off 0 divide error, for denominator = 0
 
set the default value of all denominators to one rather than zero
--
Gary''s Student - gsnu200762

dlw

Can I turn off 0 divide error, for denominator = 0
 
Any time you divide you have to either check the denominator or trap the
error, welcome to the world of programming...

" wrote:

I have a macro with many divisions, for many
of the divisions both the numerator and denominator are zero.
It's the no data case, so it's 0/0 for that condition
(or else it's a fraction).
Office 2007, integer dimensioned values.
If denominator = 0 then denominator = 1
will get round it since it's then 0/1 and still equates
to 0.
But doing this comparison a million or so
times is clearly time consuming and inefficient.
With the current database, and growing, it's approx
5M divide by 0 tests.
Any suggestions?


Niek Otten

Can I turn off 0 divide error, for denominator = 0
 
But, if I tested this right, 5M checks take less than half a second.... So why bother?

--
Kind regards,

Niek Otten
Microsoft MVP - Excel

"dlw" wrote in message ...
| Any time you divide you have to either check the denominator or trap the
| error, welcome to the world of programming...
|
| " wrote:
|
| I have a macro with many divisions, for many
| of the divisions both the numerator and denominator are zero.
| It's the no data case, so it's 0/0 for that condition
| (or else it's a fraction).
| Office 2007, integer dimensioned values.
| If denominator = 0 then denominator = 1
| will get round it since it's then 0/1 and still equates
| to 0.
| But doing this comparison a million or so
| times is clearly time consuming and inefficient.
| With the current database, and growing, it's approx
| 5M divide by 0 tests.
| Any suggestions?
|




All times are GMT +1. The time now is 04:58 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com