Rounding problem

ShawnLerner

New Member
Joined
Nov 3, 2016
Messages
11
This may be more of a math 101 question than an Excel question but I would be grateful for some help in any case.

Here is a simplified example of the problem:

Say you have 12 widgets to divide up amongst 3 people and each one is non divisible (has to be whole numbers). The distribution percentage of each is governed by a formula which tells you Person A gets 47%, Person B gets 23%, Person C gets 30%. Therefore Person A should have (12*47%)=5.64 widgets, B=2.76, C=3.6.

So, I can't just round to whole numbers because then A=6, B=3, C=4 for a total of 13 not 12. What's a formula to prorate them properly?

Thanks
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Is it fine to have widgets remaining? Or do they need to be given to the person with the decimal place closest to 1? (eg 5.64 gets 6, 2.76 gets 3, and 3.6 gets 3)
 
Upvote 0
easiest way to do this, is to decide who gets the "remaining balance", then apply the given % to the other 2, then subtract their total from the grand total.

A​
B​
C​
5​
Qty
12​
6​
A
47%​
5​
7​
B
23%​
2​
8​
C
5​
9​
12​
C6=ROUNDDOWN($B$5*B6,0)
C7=ROUNDDOWN($B$5*B7,0)
C8=B5-C6-C7
C9=SUM(C6:C8)
 
Upvote 0
ABCD
112
247%5.640.646
323%2.760.763
430%3.60.63

<tbody>
</tbody>

B2 = $B$1 * A2 copy down
C2 = MOD(B2, 1) copy down

D2 = {INT(B2)+IF(RANK(C2,$C$2:$C$4)<=($B$1-SUM(INT($B$2:$B$4))), 1, 0)}
Input with Control Shift Enter and not just enter to make an array function. {} Curly braces appear automatically if done correctly. Do not manually put in the curly braces.

Drag down
 
Last edited:
Upvote 0
Thanks for the suggestion but this doesn't really work because in the actual example there are way more than 3, so rounding all of them down but the remainder gives you numbers that are way off. Sorry, should have specified that in the OP.

easiest way to do this, is to decide who gets the "remaining balance", then apply the given % to the other 2, then subtract their total from the grand total.

A​
B​
C​
5​
Qty
12​
6​
A
47%​
5​
7​
B
23%​
2​
8​
C
5​
9​
12​

<tbody>
</tbody>

C6=ROUNDDOWN($B$5*B6,0)
C7=ROUNDDOWN($B$5*B7,0)
C8=B5-C6-C7
C9=SUM(C6:C8)
 
Upvote 0
For some reason I couldn't get this to work. I'm sure I did something wrong.

I came up with another solution. Not quite as eloquent as yours but it seemed to do the trick. FYI, here's what I did:

On row 1 I put the round down number for each person
Then put the remainder in the cell below it
Then ranked the remainders for each person from highest to lowest
Then took the total number of widgets minus the sum of the round down numbers.
Then I said if remainder = 3, add 1 to each of the round down numbers. If remainder 2, add one to each of the round down numbers ranked 1 or 2. If remainder = 1, add 1 to the 1st ranked, etc.

Unrelated question: how do you make those tables in your responses?
 
Upvote 0
On row 1 I put the round down number for each person
Then put the remainder in the cell below it
Then ranked the remainders for each person from highest to lowest
Then took the total number of widgets minus the sum of the round down numbers.
Then I said if remainder = 3, add 1 to each of the round down numbers. If remainder 2, add one to each of the round down numbers ranked 1 or 2. If remainder = 1, add 1 to the 1st ranked, etc.

That is essentially what my formula did. I just cut out a lot of the helper columns by doing the work in one cell. The reason why I had column C is I couldn't figure out how to use the RANK function with remainders of each cell in an array for the second variable... Otherwise I would have put it all into one formula.

I'm glad it works for you anyway. There is no harm in helper columns (or rows). Hide them if you do not want them visible... it's unlikely you'll run out of space on a sheet.

To answer your unrelated question:
In the message window there is a blue-ish looking table object. Click that, tell it how many rows and columns you want to insert, Choose the border you want, and it puts your table in the message. You can add or delete rows and columns using the other icons in that set. Just type your information into the table and you're done.
(If you cannot see the table object/icon, you might have to click the Advanced Editor button on the bottom near send...)
 
Upvote 0
Thanks again for the help. I see how to make a table now. It only appears when you hit "Go Advanced" not "Post quick reply".
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,695
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top