Hay, how would i go about rounded a number up the nearest multiple of 3?
ie
25 would return 27 1 would return 3 0 would return 3 6 would return 6
thanks
The MROUND function rounds a number to the nearest given multiple. The multiple to use for rounding is provided as the significance argument. If the number is already an exact multiple, no rounding occurs and the original number is returned. You can...
Excel MROUND function Number - the value you want to round. Multiple - the multiple to which you want to round the number. For example, the formula =MROUND(7, 2) rounds 7 to the nearest multiple of 2 and returns 8 as the result.
if(n > 0) return Math.ceil(n/3.0) * 3; else if( n < 0) return Math.floor(n/3.0) * 3; else return 3;
Simply:
3.0*Math.ceil(n/3.0)
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With