Running % of absolute difference

sm_Napa

New Member
Joined
Nov 7, 2016
Messages
3
I have a table of data with value 3 columns: two columns have values, the third column has the difference bteween these values, can be a negative or positive number. Without sorting the data, I want to calculate the running % of total of the difference column ignoring the sign (ie treating the difference as absolute). The purpose is this: the differences are 'variances' between actual and budget. I want to pick those items with highest absolute differences that account for at least 80% of all differences. I can do this by adding a column to convert the differences to absolute, add another column with Rank and a third column that has the running total based on the preceding two columns. But I want to do all the culations in a single column, without having to add 2 new columns (for absolute difference and rank).
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand
Hi, welcome to the board.

Your request may well be doable but it's difficult to be certain because your request is not as clear as it could be.
Could you please post back a SMALL sample of your data, showing exactly what you want to do, and what the results should be ?
If you don't want to post real data, make some up.
 
Upvote 0
Gerald is right, your request is a bit vague. But here's my first stab at it, let me know if it's close:

ABCDE
1109173%
22022-2
33033-3
440355
55057-7
6604416X
770700
88081-1
99095-5
10100110-10X
1111010010X
12120121-1
1313010030X
14140145-5
151501455
16160167-7
171701700
181801800
19190210-20X
2020017030X

<tbody>
</tbody>
Sheet1



D1: =IF(SUM(IF(ABS($C$1:$C$20)>=ABS(C1),ABS($C$1:$C$20)))>SUM(ABS($C$1:$C$20))*80%,"","X")

This is an array formula, confirm with Control+Shift+Enter. Then copy down the column. The values that have an X beside them are part of the top 80% variance. And as you can see by the green coloring, you can use this formula in Conditional Formatting.

E1: =SUM(IF(D1:D20="X",ABS(C1:C20)))/SUM(ABS(C1:C20))
with Control+Shift+Enter.

The values marked with an X probably won't hit 80% exactly, so I created this formula to see how close to 80% we got. The next lower value to be included would be ABS(-7), twice, which would raise the percentage to 82%.

Let us know if this is close at all.
 
Last edited:
Upvote 0
My apologies, I'll try again with same data. So I want to generate the output in Column G without having to create columns E and F

Excel 2013 32 bit
ABCDEFG
3ItemActualBudgetDifferenceAbs DiffRankRunning %
4A 7,310 9,700 (2,390) 2,390 1698.9%
5B - 1,100 (1,100) 1,100 1799.7%
6C 16,104 16,362 (258) 258 1899.9%
7D 32,209 21,600 10,609 10,609 564.1%
8E 47,553 64,800 (17,247) 17,247 348.2%
9F 2,655 5,400 (2,745) 2,745 1291.1%
10G 16,105 21,600 (5,495) 5,495 984.2%
11H 18,948 10,800 8,148 8,148 670.2%
12I 26,941 16,200 10,741 10,741 456.2%
13J 378,182 351,000 27,182 27,182 120.3%
14K 35,024 32,400 2,624 2,624 1597.1%
15L 106,419 86,400 20,019 20,019 235.3%
16M - - - - 22100.0%
17N - 2,700 (2,700) 2,700 1495.2%
18O 198,802 202,500 (3,698) 3,698 1087.0%
19P 5,299 5,400 (101) 101 19100.0%
20Q 34,767 27,000 7,767 7,767 776.0%
21R 89,122 86,400 2,722 2,722 1393.1%
22S 5,272 10,800 (5,528) 5,528 880.1%
23T 2,651 5,400 (2,749) 2,749 1189.1%
24U 32 35 (3) 3 21100.0%
25V 222 215 7 7 20100.0%
26
27TOTAL 1,023,617 977,812 45,805 133,833

<colgroup><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet1
 
Upvote 0
Eric W, that formula acheives what I want (I saw your reply after I posted my data). Thank you! Still need to decipher the formula logic but the output is correct!
 
Upvote 0
I wasn't too far off. Put this formula in G4 and copy down:

=SUM(IF(IFERROR(ABS($D$4:$D$25),0)>=IFERROR(ABS(D4),0),IFERROR(ABS($D$4:$D$25),0)))/SUM(IFERROR(ABS($D$4:$D$25),0))

confirmed with Control+Shift+Enter.


I just saw your latest reply. Let me know if you need help figuring out how it works. :)
 
Upvote 0
@Eric W:

Just to mention: those minus signs are actually zeros under Accounting format.
So, your nice formula would work without the IFERROR's.
 
Upvote 0
@Eric W:

Just to mention: those minus signs are actually zeros under Accounting format.
So, your nice formula would work without the IFERROR's.

Good to know! When I did the copy/paste, they showed up as a dash, which caused errors without the IFERROR. The formula would be

=SUM(IF(ABS($D$4:$D$25)>=ABS(D4),ABS($D$4:$D$25)))/SUM(ABS($D$4:$D$25))

without them. Thanks for the tip.
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,323
Members
449,218
Latest member
Excel Master

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