I just wanted to share what I've had to setup in one of my families. There are a few rounding threads out there, but none really addressed what I needed fully. I needed to round up to the nearest 6". What I ended up with was being able to round to any desired interval, up or down or either direction.
You need 3 parameters added (or calculated values if using schedules):
RoundingInterval as Length (or could be another type if rounding volume, currency, decimal numbers, etc. <should match the type of value you are trying to round)
NumberOfIntervals as Integer
RoundedValue as Length (should match type of RoundingInterval)
To Round up...Then your formulas should be similar to this to :
ActualValue will = the parameter value your trying to round
RoundingInterval = 0' 6" (Set this to any interval you need to round to, 1/16", 3", 8.75", 1' 6"... whatever)
NumberOfIntervals = (ActualValue + (RoundingInterval / 2 - 0' 0 1/256")) / RoundingInterval
RoundedValue = RoundingInterval * NumberOfIntervals
To Round down... change NumberOfIntervals formula to match this:
NumberOfIntervals = (ActualValue - (RoundingInterval / 2 - 0' 0 1/256")) / RoundingInterval
To Round either direction... change NumberOfIntervals formula to match this:
NumberOfIntervals = ActualValue / RoundingInterval
Hope this helps someone save some time searching and experimenting. Enjoy