View Single Post
  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Round Up by a factor not by a digit [MROUNDUP(number,multiple)]

Public Function MyCeiling(rng As Range, by)
If rng.Count 1 Then
MyCeiling = CVErr(xlErrRef)
Exit Function
End If

MyCeiling = ((rng.Value + by - 1) \ by) * by
End Function


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

wrote in message
ps.com...
On May 24, 6:41 pm, "David Biddulph" <groups [at] biddulph.org.uk
wrote:
=CELING(number,multiple)
--
David Biddulph

wrote in message

oups.com...3 questions
really, first most relevant and important:

1) I want the functionailty of mround() i.e. rounding by a factor, but
I want it to be rounded up as in roundup, but roundup rounds up by a
specified number of digits not a factor.
Can this be achieved without code?


...

Thanks for that David - that does what I'm after.
I'm keen to learn how to write my own functions and would like to use
some microsoft functions as a starting point.
So using =ceiling(number,multiple/digit) as an example can anyone
supply the code that would be required to make this function if it
didn't exist already in excel?