Rounding Values to 100%

Amosbroker

New Member
Joined
Mar 26, 2018
Messages
32
I extract data and pull in to graphs. Quite often, I have 99% or 101% with the data that I am assessing. How do I tell Excel to look at my values and round those that make the most sense so that when added together equal 100%. I spend so much time looking at these partial percentages determining which should be changed in order to equal a whole 100% chart.

Below is a snapshot of the table I use. I have another table that looks at movement and has 8 categories, this one really has issues with equaling 100%. For each formula, I round the percentages to 2 digits. Currently, I have the cell conditional formatted to turn red when it does not equal 100% so I can do the manual leg work to figure out which cell needs to change to total 100%. I would prefer a formula or even VBA do this for me.

[TABLE="width: 493"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Healthy[/TD]
[TD]Moderate[/TD]
[TD]High[/TD]
[TD]Unknown[/TD]
[TD]Assessed[/TD]
[TD]100 Check[/TD]
[/TR]
[TR]
[TD]22%[/TD]
[TD]29%[/TD]
[TD]47%[/TD]
[TD]2%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]56%[/TD]
[TD] [/TD]
[TD]39%[/TD]
[TD]5%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]24%[/TD]
[TD]40%[/TD]
[TD]27%[/TD]
[TD]9%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]66%[/TD]
[TD]26%[/TD]
[TD]8%[/TD]
[TD]1%[/TD]
[TD]454[/TD]
[TD]101%[/TD]
[/TR]
[TR]
[TD]79%[/TD]
[TD]9%[/TD]
[TD]11%[/TD]
[TD]1%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]70%[/TD]
[TD]21%[/TD]
[TD]7%[/TD]
[TD]2%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]24%[/TD]
[TD]40%[/TD]
[TD]27%[/TD]
[TD]9%[/TD]
[TD]454[/TD]
[TD]100%[/TD]
[/TR]
[TR]
[TD]63%[/TD]
[TD]27%[/TD]
[TD]9%[/TD]
[TD]2%[/TD]
[TD]454[/TD]
[TD]101%[/TD]
[/TR]
</tbody>[/TABLE]
 
Thanks for the input, guys. I think I am going to propose using partial percentages moving forward. It makes more sense to have an accurate picture of data than to spend so much time manipulating for the sake of 2 and 1 digit numbers totaling 100%.
 
Upvote 0

Excel Facts

Get help while writing formula
Click the italics "fx" icon to the left of the formula bar to open the Functions Arguments dialog. Help is displayed for each argument.
I know this is a bit old, but I was thinking about this and have a reason to want whole numbers (rounded) but they need to total to 360.
Yes, I understand this is manipulating the actual data a bit - but that is the desire for whatever reason. What I did was this in columns:
  • round each number down [round down]
  • put the decimal part in the next column [remainder range]
  • have a column with sequential index numbers (1, 2, 3, ...) [index]
  • sum the rounded down column into a cell
  • in another cell subtract the sum from my number (which was 360) [to add] (in the example, I put it in K2)
  • use index-match with the large function =index(match(large([remainder range],[index]),[remainder range],0),1)
  • in the next column, add 1 to the rounded down number if the sequential row is within a range of the top remainders the size of the number needed to add
The last column will have essentially rounded the numbers with the largest remainder back up, doing so the number of times to get to the required sum.
1606584284158.png

Top cell (Original numbers) is F2
G3 =ROUND(F3,0)
I3 =ROUNDDOWN(F3,0)
J3 =F3-TRUNC(F3)
K2 =360-I14
N3 =INDEX(MATCH(LARGE($J$3:$J$13,L3),$J$3:$J$13,0),1)
O3 =I3+COUNTIF(OFFSET($N$3,0,0,$K$2),L3)
 
Upvote 0
I suggest to search for "round summands to match a total".
TCRound is a commercial solution.
Gustav Brock offers a free VBA.
 
Upvote 0
Looking at RobVos's example, this would be a worksheet function approach (D1 has the value TRUE!):
RobVos is rounding the 9th number into the "wrong" direction, my functions do this for the 8th (because it is the first one of two with the same minimal absolute error)
MrExcel_Rounding_Values_to_100_Percent.xlsx
ABCDEFGH
1bAbsSumWAHRTotal objective
2Decimals to round to:0Difference to rounded
3Absolute valuesRelative valuesRounded valuesErrorRank of360,0000Result
4Total360,0000100,0000361,0000error-1,0000360,0000
51106,940729,7057107,00000,059360,0000107,0000
6252,331614,536652,0000-0,3316110,000052,0000
738,69252,41469,00000,307540,00009,0000
8434,66579,629435,00000,334330,000035,0000
952,97540,82653,00000,024670,00003,0000
10650,934914,148651,00000,065150,000051,0000
1173,14770,87443,0000-0,147790,00003,0000
1289,56122,655910,00000,43881-1,00009,0000
1399,56122,655910,00000,438820,000010,0000
141081,189222,552681,0000-0,1892100,000081,0000
15110,00000,00000,00000,000080,00000,0000
RoundToSum
Cell Formulas
RangeFormula
G3G3=ROUND(IF($D$1,SUM(B5:B15),SUM(C5:C15)),$D$2)
H4,B4:D4B4=SUM(B5:B15)
G4G4=G3-D4
C5:C15C5=B5/$B$4%
D5:D15D5=ROUND(IF($D$1,B5,C5),$D$2)
E5:E15E5=D5-IF($D$1,B5,C5)
F5:F15F5=COUNTIF($E$5:$E$15,IF($G$4>0,"<",">")&$E5)+COUNTIF($E$5:$E5,$E5)
G5:G15G5=IF(F5<=ROUND(ABS($G$4*10^$D$2),0),SIGN($G$4)*10^-$D$2,0)
H5:H15H5=D5+G5


If you round not to integers but to 10 (not ROUND(x,0) but ROUND(x,-1)) you would need to round the 4th number into the "wrong" direction:
MrExcel_Rounding_Values_to_100_Percent.xlsx
ABCDEFGH
1bAbsSumWAHRTotal objective
2Decimals to round to:-1Difference to rounded
3Absolute valuesRelative valuesRounded valuesErrorRank of360,0000Result
4Total360,0000100,0000350,0000error10,0000360,0000
51106,940729,7057110,00003,0593110,0000110,0000
6252,331614,536650,0000-2,331640,000050,0000
738,69252,414610,00001,3075100,000010,0000
8434,66579,629430,0000-4,6657110,000040,0000
952,97540,82650,0000-2,975430,00000,0000
10650,934914,148650,0000-0,934960,000050,0000
1173,14770,87440,0000-3,147720,00000,0000
1289,56122,655910,00000,438880,000010,0000
1399,56122,655910,00000,438890,000010,0000
141081,189222,552680,0000-1,189250,000080,0000
15110,00000,00000,00000,000070,00000,0000
RoundToSum
Cell Formulas
RangeFormula
G3G3=ROUND(IF($D$1,SUM(B5:B15),SUM(C5:C15)),$D$2)
H4,B4:D4B4=SUM(B5:B15)
G4G4=G3-D4
C5:C15C5=B5/$B$4%
D5:D15D5=ROUND(IF($D$1,B5,C5),$D$2)
E5:E15E5=D5-IF($D$1,B5,C5)
F5:F15F5=COUNTIF($E$5:$E$15,IF($G$4>0,"<",">")&$E5)+COUNTIF($E$5:$E5,$E5)
G5:G15G5=IF(F5<=ROUND(ABS($G$4*10^$D$2),0),SIGN($G$4)*10^-$D$2,0)
H5:H15H5=D5+G5
 
Upvote 0
Thanks for the input, guys. I think I am going to propose using partial percentages moving forward. It makes more sense to have an accurate picture of data than to spend so much time manipulating for the sake of 2 and 1 digit numbers totaling 100%.
I had this pinned but never commented on till now...
The calculated percentages should not be rounded. They should be displayed to the desired decimal place.
The SUM of the percentages should be rounded. There can be a small variance thanks to the limited decimal places in memory for number storage.
 
Upvote 0
Sorry, no.
When rounded summands do not match their rounded sum, you need to round some of them into the "wrong" direction to make it match.
Try to give one Cent to a) two people or b) to three people. In the first case you would give 2 Cents if you round 0.5 to 1 for both summands (so you need to round one of them down "erroneously"), but in the latter you would not give anything if you round 0.3333... to 0 (unless you round one of them up to 1).
 
Upvote 0
Sorry, no.
When rounded summands do not match their rounded sum, you need to round some of them into the "wrong" direction to make it match.
Try to give one Cent to a) two people or b) to three people. In the first case you would give 2 Cents if you round 0.5 to 1 for both summands (so you need to round one of them down "erroneously"), but in the latter you would not give anything if you round 0.3333... to 0 (unless you round one of them up to 1).
I believe you misunderstand.
The individual calculations for the percentages are not rounded.
The Sum of the individual items would be rounded to 0 decimal places.
There would likely be errors in the raw sum. Something likely around 5E-11. Rounding that sum should maintain a 100%
Yes. An annotation must be made to explain that the displayed %'s may not appear to equal 100. That is because they are rounded in the displayed value to whatever desired decimal place.

A cent to more than one person? We don't cut our pennies up like in ye'old England!
 
Upvote 0
I beg to differ because I think the problem at hand could best be described as "rounding summands preserving their rounded sum".
If you google for that you will find several solutions, one of them from Gustav Brock.
 
Upvote 0
Its two different approaches. When we get to the pennies of a distribution, a solution like the one referenced is suitable or even necessary.
However, when looking at the percentages of referenced values, it may be inappropriate to say one received a percentage more than the other 2.
Column C is displayed to the one decimal place and shows each being an equal percentage. Yet column C has no rounding applied. Their sum equals 100% without any finagling.
Column D has rounding applied, which leads to the sum being off.
In either case, if the %'s are used to distribute dollar amount, the dollar amounts will likely be off.

So its a matter of the application to which method may be best. However I feel that the better answer to the OP's case is to not round the values except for the SUM amount to ensure certain base2 to base10 issues sometimes found with IEEE754 (and additional limitations with MS)

Cell Formulas
RangeFormula
B2:D2C2=FORMULATEXT(C3)
C3:C5C3=B3
D3:D5D3=ROUND(C3,3)
C6:D6C6=SUM(C3:C5)
B3:B5B3=A3/$A$1
 
Upvote 0
You won't value my suggested approach unless you need to book both inputs and outputs in your company's accounting system. But then you will regret a cent's difference because your accountant does.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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