Posted to microsoft.public.excel.programming
|
|
Macro Ceiling & Floor Calculation Problem...
Hi Kevin,
How are your variables declared? It may be that you've declared them as
Integer or Long when they should be declared as Single or Double.
--
Regards,
Jake Marx
MS MVP - Excel
www.longhead.com
[please keep replies in the newsgroup - email address unmonitored]
Kevin Lyons wrote:
Hello,
The following macro calculations are not acting as I expect them to
for a select group of numbers:
fullRange = finishRange - startRange
actName = Application.Ceiling(fullRange / 3, 1)
diffName = (fullRange - actName) / 2
ceilName = Application.Ceiling(diffName, 1)
floorName = Application.Floor(diffName, 1)
Given fullRange = 2 then actName = 1, but diffName = 0, ceilName = 0,
& floorName = 0
Shouldn't diffName = .5, ceilName = 1, and floorName = 0?
Similarly, Given fullRange = 5 then actName = 2, but diffName = 2,
ceilName = 2, & floorName = 2
Shouldn't diffName = 1.5, ceilName = 2, and floorName = 1?
From 1 to 10, the other numbers appear to function correctly. There
might be even others where this doesn't work, but I haven't checked
yet.
Thanks much for any help.
Kevin
|