straybullet
IS-IT--Management
I need to use the Excel ceiling function in an Access DB.
So far, Ive been trying to work with:
Function Ceiling(ByVal X As Double, Optional ByVal Factor As Double = 1) _
As Double
Ceiling = (X \ Factor - (X / Factor - X \ Factor > 0)) * Factor
End Function
When running the query, this produces error 11 (division by 0) even though none of the cells are blank nor do any have a zero value. SP1: Ceiling([HPC_BASE]/[MARKUP_1],[MARKUP_2])
What SP1 (Sale Price) needs to be is the HPC_BASE (Base Hard Product Cost) divided by MARKUP_1 (value less than 1 - currently .67 or .72). The result needs to be rounded up to the value of MARKUP_2 (chosen increment for the product - .10, 10, 100)
Can anyone suggest either the proper error handling or a even a completely different function?
Let them hate - so long as they fear... Lucius Accius
So far, Ive been trying to work with:
Function Ceiling(ByVal X As Double, Optional ByVal Factor As Double = 1) _
As Double
Ceiling = (X \ Factor - (X / Factor - X \ Factor > 0)) * Factor
End Function
When running the query, this produces error 11 (division by 0) even though none of the cells are blank nor do any have a zero value. SP1: Ceiling([HPC_BASE]/[MARKUP_1],[MARKUP_2])
What SP1 (Sale Price) needs to be is the HPC_BASE (Base Hard Product Cost) divided by MARKUP_1 (value less than 1 - currently .67 or .72). The result needs to be rounded up to the value of MARKUP_2 (chosen increment for the product - .10, 10, 100)
Can anyone suggest either the proper error handling or a even a completely different function?
Let them hate - so long as they fear... Lucius Accius