Excel Custom Function with Select Case
J.E. McGimpsey,
Thank you very much for your solution!
I don't completely understand it, so please allow me to ask a few follow-up
questions.
I tried using a pos 9.2, and your routine gives the correct answer of 10.
I understand the following:
dIn=9.2
Sgn(dIn)=1 (positive)
(dIn<Fix(dIn))=True (which I interpret to be 1)
My question is, when I examine "Sgn(dIn) * (dIn < Fix(dIn))", the PC
shows -1, but I think (incorrectly, it appears) that it should be positive
1, because it is 1*1? Where I am going wrong with my thinking?
Again, appreciative of your answer.
Regards,
Kevin
"J.E. McGimpsey" wrote in message
...
If you're interested in speed, this is about 40% faster on my
machine than the one you posted:
Function VBRoundUpInt(ByVal dIn As Double) As Double
VBRoundUpInt = Fix(dIn - Sgn(dIn) * (dIn < Fix(dIn)))
End Function
In article ,
"Kevin Stecyk" wrote:
Below is a "roll-your-own" round up function written by Myrna Larson and
myself. We were interested in speed, and
application.worksheet.functions
tend to be a bit slow. Though for your purposes it might be plenty
fast.
|