View Full Version : #Error throwing off calculation


canberry
02-19-2009, 04:21 AM
Hi all. I get a #Error even when my formula boils down to eg... ((A-B) + (C/D)) * .10
Where C and D = 0. A= 30, B=4
I really want the output to be 2.6

Tell me if i need to post my formula

SQL_Hell
02-19-2009, 04:35 AM
If D is zero then that's your problem you cant divide by zero. Try it on a calculator...it's not possible

Dennisk
02-19-2009, 04:36 AM
Division by zero C/D where D = 0 is the cause of your problem

canberry
02-19-2009, 05:06 AM
Yea, i agree u cant divide 0/0. But that result added to a figure should return that figure. (0/0) + 8 = 8.

Does any 1 have any experience with the NullToZero function. I tried it in my query but it not working ?

Atomic Shrimp
02-19-2009, 05:12 AM
You can't divide anything by zero - it's fundamentally impossible.

What real-world information is this formula representing? (because it sounds like it might not be doing so properly).

Null to zero won't help, as that converts to zero.

DCrake
02-19-2009, 05:21 AM
Try

((A-B) + iif(C>0 And D> 0,(C/D),0)) * .10

Atomic Shrimp
02-19-2009, 05:33 AM
Try

((A-B) + iif(C>0 And D> 0,(C/D),0)) * .10

((A-B) + iif(D> 0,(C/D),0)) * .10 should work OK - because you can divide 0 by things, just not the other way around.

canberry
02-19-2009, 09:52 AM
:D Good to go.Thanks alot