Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Excel: How to Get 'Parts' to Equal 'Total'

Status
Not open for further replies.

CrystalFacets

Technical User
Nov 3, 2016
28
US
I have a column of numbers (see 'Qty' column on attached file) that need to be divided in half and the resulting values placed in columns b and c.

I use the ROUND function in order to do the calculation. However, when the 'parts' are added together, the sum does not always add back up to the original total.

How do I get the result of each division (rows 2-11) to add back up to each original Qty.

Thank you for assistance!

 
 https://files.engineering.com/getfile.aspx?folder=6041adbc-4eb8-4bed-a5f0-30fda38b8493&file=sample.xlsx
Hi,

Guess what: you have 7 odd numbers in Qty and you have a variance of... 7!

PkgB values should be Qty - PkgA.
[pre]
Qty PkgA PkgB Variance
30 15 15 0
76 38 38 0
91 46 45 0
55 28 27 0
67 34 33 0
63 32 31 0
39 20 19 0
44 22 22 0
43 22 21 0
53 27 26 0

Total
561 284 277 0
[/pre]

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
AD1D550E-FCB5-4AB6-A3C8-1F86CACE2554_ne1bcz.jpg
 
Yes, Skip, I know the odd numbers are causing the calculation issues.

I'm seeking a formula to copy down down 10M+ rows in columns b & c that will accomplish the following:
1. For each line (before total line), the formula in columns b & c will return a variance of 0 in column d.
2. The total line for columns b & c will be close to 50%-50% (e.g. 280+281).

Thanks in advance for feedback.
 
Well now you moved the goalposts!

Is there anything else we ought to know before venturing a solution to the new and improved requirements?

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
AD1D550E-FCB5-4AB6-A3C8-1F86CACE2554_ne1bcz.jpg
 
Here's my solution to your current requirements...
[pre]
Qty PkgA PkgB Variance
30 15 15 0
76 38 38 0
91 46 45 0
55 27 28 0
67 34 33 0
63 31 32 0
39 20 19 0
44 22 22 0
43 21 22 0
53 27 26 0

Total
561 281 280 0
[/Pre]

[tt]
PkgB: =Qty-PkgA
B2: =IF(NOT(ISNUMBER(A1)),0,IF(SUM(A1:A$2)/2-SUM(B1:B$2)<0,IF(MOD(A2,2)=1,-1,0)))+ROUND(A2/2,0)
[/tt]
Copy cell B2 & PASTE Down thru all rows.

The other thing I'd do is put your totals above your table. No one wants to hunt for the payoff. Totals at the bottom of a table/report is reminiscent of paper, pencil, calculator, page subtotals and grand totals. We're way past that.

Skip,
[sub]
[glasses]Just traded in my OLD subtlety...
for a NUance![tongue][/sub]
"The most incomprehensible thing about the universe is that it is comprehensible" A. Einstein
AD1D550E-FCB5-4AB6-A3C8-1F86CACE2554_ne1bcz.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top