Hi, need some help trying to figure out a logic to do rounding. So what I would have would be 6 variables with whatever amount.

- Divide each variable by 1000
- Use math floor on all of them
- Calculate the difference between the total before rounding and after
- The remaining total (rounded to nearest whole) will then be distributed to the variables with the highest decimal

The main issue for me is after getting the decimals, sorting them by largest to smallest and then adding 1 value to each in descending order until the total difference reaches 0.

Visual Representation (No actual table to read, just showing how it would look like):