Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 12
Default Divide a # into 3 #'s rounded to a whole #

I have a Cost that must be divided into 3 separate percentages that my company can bill against. We don't like to input any budget numbers into our accounting system that contain cents, so we round all of our numbers up or down manually so that they may be added up to equal the original total.

So if I have a cost of $17, and I have to divide it into 3 numbers (15%, 35%, & 50%), how can i create three separate formulas to automatically round the 3 numbers to the nearest whole dollar and still create a sum of $17?

Assume $17 = H35, 15% = H6, 35% = H7, & 50% = H8
I tried the following, which seems to not work for all total numbers:
=Rounddown(H35*H6,0) = 2
=Roundup(H35*H7,0) = 6
=Rounddown(H35*H8,0) = 8
Sum of numbers = $16

I need the 3 formulas to work with any number that I input into H35. I may be changing the 3 %'s also in the future, so the formula would have to work with different %'s.

Any help would be appreciated

Last edited by TreeHugger1 : February 7th 13 at 12:28 AM Reason: I needed to explain one more variable.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,045
Default Divide a # into 3 #'s rounded to a whole #

On Thu, 7 Feb 2013 00:19:53 +0000, TreeHugger1 wrote:


I have a Cost that must be divided into 3 separate percentages that my
company can bill against. We don't like to input any budget numbers into
our accounting system that contain cents, so we round all of our numbers
up or down manually so that they may be added up to equal the original
total.

So if I have a cost of $17, and I have to divide it into 3 numbers (15%,
35%, & 50%), how can i create three separate formulas to automatically
round the 3 numbers to the nearest whole dollar and still create a sum
of $17?

Assume $17 = H35, 15% = H6, 35% = H7, & 50% = H8
I tried the following, which seems to not work for all total numbers:
=Rounddown(H35*H6,0)
=Roundup(H35*H7,0)
=Rounddown(H35*H8,0)

Any help would be appreciated


In general, you would compute n-1 of the numbers, then subtract them from the total to get the nth number.

So if your formulas are in I6:I8, they might look like:

$I$6: =ROUND($H$35*H6,0)
$I$7: =ROUND($H$35*H7,0)
$I$8: =$H$35-SUM(I6:I7)


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Divide a # into 3 #'s rounded to a whole #

"Ron Rosenfeld" wrote:
In general, you would compute n-1 of the numbers, then
subtract them from the total to get the nth number.
So if your formulas are in I6:I8, they might look like:
$I$6: =ROUND($H$35*H6,0)
$I$7: =ROUND($H$35*H7,0)
$I$8: =$H$35-SUM(I6:I7)


Although that does work for the example given, and it might work for any
__3__ percentages, it does not work "in general" for any n percentages.

Consider an example with 15% in H6:H11 and 10% in H12. With a total of 17
in H35, the result in I6:I12 would be 3,3,3,3,3,3 (a subtotal of 18!)
and -1(!).

A more reliable, but still simple approach is:

I6: =ROUND(H6*$H$35,0)
I7: =ROUND(SUM($H$6:H7)*$H$35-SUM($I$6:I6),0)

Copy I7 down through I12.

The ROUND function in I12 should mask any arithmetic anomalies that arise
because SUM(H6:H12) might not be (usually is not) exactly 100%. But if you
prefer, the formula in I12 could be:

I12: =$H$35-SUM($I$6:I11)

The result in I6:I12 is 3,2,3,2,3,2,2, which does indeed sum to 17.

For TreeHugger's original example, the result is 3,6,8, which is the same as
Ron's approach.

-----

For an algorithm that claims to minimize absolute relative error, you might
look at Bernd Plumhoff's webpage at
http://www.sulprobil.com/html/largest_remainder.html.

But frankly, I usually find his descriptions confusing. And I have not been
able to download his Excel implementations for a long time. (Is a donation
__required__ now?) Moreover, many (all?) of the files now require Excel
2007 or later.

PS: And I coulda sworn his we


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 277
Default Divide a # into 3 #'s rounded to a whole #

On Wed, 6 Feb 2013 23:54:46 -0800, "joeu2004" wrote:

Although that does work for the example given, and it might work for any
__3__ percentages, it does not work "in general" for any n percentages.

Consider an example with 15% in H6:H11 and 10% in H12. With a total of 17
in H35, the result in I6:I12 would be 3,3,3,3,3,3 (a subtotal of 18!)
and -1(!).

A more reliable, but still simple approach is:

I6: =ROUND(H6*$H$35,0)
I7: =ROUND(SUM($H$6:H7)*$H$35-SUM($I$6:I6),0)

Copy I7 down through I12.

The ROUND function in I12 should mask any arithmetic anomalies that arise
because SUM(H6:H12) might not be (usually is not) exactly 100%. But if you
prefer, the formula in I12 could be:

I12: =$H$35-SUM($I$6:I11)

The result in I6:I12 is 3,2,3,2,3,2,2, which does indeed sum to 17.

For TreeHugger's original example, the result is 3,6,8, which is the same as
Ron's approach.

-----

For an algorithm that claims to minimize absolute relative error, you might
look at Bernd Plumhoff's webpage at
http://www.sulprobil.com/html/largest_remainder.html.

But frankly, I usually find his descriptions confusing. And I have not been
able to download his Excel implementations for a long time. (Is a donation
__required__ now?) Moreover, many (all?) of the files now require Excel
2007 or later.

PS: And I coulda sworn his we



Nice thread, guys. Just sayin'. Instructive... educational even.
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,045
Default Divide a # into 3 #'s rounded to a whole #

On Wed, 6 Feb 2013 23:54:46 -0800, "joeu2004" wrote:

Although that does work for the example given, and it might work for any
__3__ percentages, it does not work "in general" for any n percentages.


Thank you for that observation. You are, of course, correct.


  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 277
Default Divide a # into 3 #'s rounded to a whole #

On Thu, 7 Feb 2013 16:54:26 +0000, TreeHugger1
wrote:


Wow, very easy. Thank you very much for the help.

Paga Mike;1609193 Wrote:
With 17 in A1, In A2 thru A4, enter:

=ROUND(0.15*A1,0)
=ROUND(0.35*A1,0)
=A1-A2-A3


I hope you read the whole thread.
  #7   Report Post  
Junior Member
 
Posts: 12
Default

I did review everything. Thank you. The 1st response is easy to understand. It took me a while to figure out the 2nd response. Thank you both!

Quote:
Originally Posted by CellShocked View Post
On Thu, 7 Feb 2013 16:54:26 +0000, TreeHugger1
I hope you read the whole thread.
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 829
Default Divide a # into 3 #'s rounded to a whole #

Errata.... I wrote:
"Ron Rosenfeld" wrote:
In general, you would compute n-1 of the numbers, then
subtract them from the total to get the nth number.
So if your formulas are in I6:I8, they might look like:
$I$6: =ROUND($H$35*H6,0)
$I$7: =ROUND($H$35*H7,0)
$I$8: =$H$35-SUM(I6:I7)


Although that does work for the example given, and it might work for any
__3__ percentages, it does not work "in general" for any n percentages.

[....]
A more reliable, but still simple approach is:
I6: =ROUND(H6*$H$35,0)
I7: =ROUND(SUM($H$6:H7)*$H$35-SUM($I$6:I6),0)
Copy I7 down through I12.


On second thought, neither approach is always reliable.

Consider the following example, which is intended to sum to 27:

data myRound ronsRound
0.02 0 0
0.54 1 1
1.39 1 1
4.60 5 5
7.74 7 8
11.44 12 11
1.27 1 1

Ron's result is more intuitive, IMHO.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Divide a # into 3 #'s rounded to a whole # TreeHugger1 Excel Worksheet Functions 2 February 7th 13 04:54 PM
add rounded numbers using the rounded value Ruth Excel Discussion (Misc queries) 2 February 8th 10 07:59 PM
Rounded Rectangle Adrian D. Bailey Excel Programming 3 March 26th 07 05:58 PM
Divide one row over other row I dont wont to divide one number Rick Excel Discussion (Misc queries) 0 March 4th 05 07:13 PM
Divide Expression stops in Macro when Can't divide JUAN Excel Programming 6 May 6th 04 07:05 AM


All times are GMT +1. The time now is 11:54 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"