Upper rounding equation

Hello, I would like to obtain the upper rounding of a global variable in Solidworks 2013.

Example:

223.2 -> 225;

226.7 -> 230;

231 -> 235.

223.2/5=44.64 > 44.64 rounded up to 45 > 45*5=225

226.7/5=45.34 > 45.34 rounded up to 46 > 46*5=230

231/5=46.2 > 44.64 rounded up to 47 > 47*5=235

3 Likes

Thank you very much Tomalam.

So this gives me the equation:  (Int(Y/5)+1)*5.

2 Likes

Hello

Careful! Your formula does not handle special cases if your variable "Y" is a multiple of 5 perfect.

For example, if Y=230 the result is 235 instead of 230!

But maybe that's what you want?

The function (EXCEL) to handle this is:

"=ENT((Y/a)+SIGN(Y-(ENT(Y/a)*a))*1)*a" (with a=5)

Note:

To replace the "SIGNE" function in Excel, SI conditions must be used

if Y MOD has > 0 then 1 otherwise if Y MOD has < 0 then -1 otherwise 0

A+

1 Like