# Distribute total: how to manage rounding rest

Hello everyone,

I’ve to distribute the net weight of a box on the items quantity inserted in the box, for example:

Box net: 10Kg

Item A: 3pcs
Item B: 3pcs
Item C: 3pcs

If I use “Distribute total” and then round to 2nd decimal, the result will be:
Item A: 3,33Kg
Item B: 3,33Kg
Item C: 3,33Kg

The problem is that the SUM of the items net is 9.99Kg, not 10Kg.
Usually, in case similar to this, I put the difference between calculated and original in the last item:
Item A: 3,33Kg
Item B: 3,33Kg
Item C: 3,34Kg

How I can manage this?

ATM the solution is:
1> Enumerate rows;
Item A: 3pcs 3,33 1
Item B: 3pcs 3,33 2
Item C: 3pcs 3,33 3

• Subtotal the Max row number;
Item A: 3pcs 3,33 1 3
Item B: 3pcs 3,33 2 3
Item C: 3pcs 3,33 3 3

• Rule if current num row = max num row, add the delta;
Item A: 3pcs 3,33 1 3
Item B: 3pcs 3,33 2 3
Item C: 3pcs 3,34 3 3

It works, but maybe there’s a better way to achieve this.

This method seems fine to me. Identifying the last row is easy in EasyMorph. Running total is easy too.