I need help with complex rounding

I need to know how to round by a certain variable instead of just one or ten etc. I want to know how to round to the nearest multiple of eight, for example.

2 Likes

You can use this in an Expression block:

Math.round(A / B) * B;

How it works (example A = 83, B = 8, round A to the nearest multiple of B):

83 / 8 = 10.375
10.375 rounded = 10
10 * 8 = 80
4 Likes