smichaels1234
06-04-2008, 05:08 AM
I am trying to run this formula (=([NonShippable]/[Qty_Needed])*-[OnHandBalance]) but for some reason I am getting #Error for any fields that do not have anything in them. Any suggestions? I am guessing it has to do with Nulls.
KenHigg
06-04-2008, 05:25 AM
Try something like the following:
(nz([NonShippable])/nz([Qty_Needed]))*-nz([OnHandBalance]))
The nz() function replaces nulls with a zero.
If you use it in a query you need to add the value to use if it does find a null:
(nz([NonShippable],0)/nz([Qty_Needed],0))*-nz([OnHandBalance],0))
Hope this helps - :)
smichaels1234
06-04-2008, 05:48 AM
Neither one of them worked. I am not using it in a query. I am just creating the formula. Adding a new field in the report.
KenHigg
06-04-2008, 05:59 AM
Try doing something a bit more simple and work up. Try something like:
nz([NonShippable],0)
and if that works then maybe:
nz([NonShippable],0)/nz([Qty_Needed],0)
???
smichaels1234
06-04-2008, 06:26 AM
When I just put this in =nz([NonShippable]) it works properly. I go any further and those #Errors come back.
KenHigg
06-04-2008, 06:50 AM
What about just:
=nz([Qty_Needed])
???
KenHigg
06-04-2008, 06:53 AM
Ah... I see you could get a div by zero error.
What about:
=(nz([NonShippable],0)/nz([Qty_Needed],1))*-nz([OnHandBalance],0))
???
smichaels1234
06-04-2008, 07:03 AM
Still not working. Very weird and stressful.
smichaels1234
06-04-2008, 07:04 AM
This is one way that I got it to pass correctly but the numbers are far from being correct:
=nz((([NonShippable]," ")/nz([Qty_Needed])*-nz([OnHandBalance]))
KenHigg
06-04-2008, 07:38 AM
Are all of the fields numeric data types or is NonShippable a text field?
smichaels1234
06-04-2008, 09:46 AM
Thanks for your help. I figured it out. I needed an IIF Statement in there.
KenHigg
06-04-2008, 10:35 AM
Really...?
Oh well, glad you have it workin' :)