count with the number of cells by that equal a target by summing the range.

p4nny

Board Regular
Joined
Jan 13, 2015
Messages
246
Hi,

In my example, I'm trying to create a formula that would return the "numbers of customers making up 80% of revenue".

I want to sum accounts cumulatively until the target is reached "80%") (or the closest match) and count how many accounts this is.

Many thanks for your help, Anthony

Column A Column B
TOTAL SALES 812,559.27
80% of TOTAL SALES 650,047.42
NUMBER OF ACCOUNTS MAKING 80% OF TOTAL SALES????
Account 2014 Net Sales
P2063001 292,575.82
P2568001 110,493.34
P1790003 100,088.84
P1790004 94,744.40
P1126001 86,057.82
P2744002 53,009.23
P1790006 44,677.92
P0973000 18,881.50
P1790008 11,578.72
P2676002 610.08
P1790000- 158.40

<colgroup><col><col></colgroup><tbody>
</tbody>
 
Tested up to row 300:

Excel 2010
AB
1TOTAL SALES73,811,241.00
280% of TOTAL SALES59,048,992.80
3NUMBER OF ACCOUNTS MAKING 80% OF TOTAL SALES160
4
5
6Account2014 Net Sales
7P2744002498526
8P1790073496909
9P1790068496872

<colgroup><col style="width: 25pxpx"><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Trade History


....

Excel 2010
AB
291P179000618904
292P179008715861
293P267600215412
294P179001213809
295P097300011745
296P17901666389
297P26760024460
298P25680013696
299P17900111343
300P17901271030

<colgroup><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Trade History
Worksheet Formulas
CellFormula
B1=SUM(B7:B300)
B2=B1*0.8

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Array Formulas
CellFormula
B3{=MATCH(MIN(ABS((MMULT(N(TRANSPOSE(ROW(B7:B300))<=ROW(B7:B300)),B7:B300)-B2))),ABS((MMULT(N(TRANSPOSE(ROW(B7:B300))<=ROW(B7:B300)),B7:B300)-B2)),0)}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>
 
Upvote 0

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Thanks for that... I'm running Excel 2007. I will try it on a different system with Excel 2010.

Appreciate your help.
 
Upvote 0
Thanks for your reply.. I think minimum would be best.

Using the $650k as a target, cumulatively sum the values in each account until the $650k is achieved and return the number of accounts that make up the £650k.

Interesting that you still don't give that count (it must be something too obvious.).

Control+shift+enter, not just enter:
Rich (BB code):
=MATCH(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1)),1)

If the count must satisfy the relation >= 650,047.42...
Rich (BB code):
=MATCH(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1)),1)+
  (LOOKUP(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1))) < B2)
 
Upvote 0
Hi, you provided the above formula a while ago and it works fantastic..

For it to work, my data must already be ranked highest to lowest... would there a way incorporating that function into here?
 
Upvote 0
Hi, you provided the above formula a while ago and it works fantastic..

For it to work, my data must already be ranked highest to lowest... would there a way incorporating that function into here?

Which formula are you addressing?
 
Upvote 0
Hi- this

=MATCH(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1)),1)+
(LOOKUP(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1))) < B2)
 
Upvote 0
Also, how would I add a criteria to this?

basically, I would like the formula to work only where column A (range) ="DK10" (criteria)

hope that makes sense
 
Upvote 0
Hi- this

=MATCH(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1)),1)+
(LOOKUP(B2,SUBTOTAL(9,OFFSET(B7,0,0,ROW($B$7:$B$17)-ROW(B7)+1))) < B2)

This formula does not require any sorting involving B7:B17. Am I missing something?
 
Upvote 0
For the formula to work the data has to already be in ascending order as it counts how many customers make up a target figure.. if the data is not sorted then it will the complete wrong answer.. Would it be possible to add the above criteria?
 
Upvote 0
For the formula to work the data has to already be in ascending order as it counts how many customers make up a target figure.. if the data is not sorted then it will the complete wrong answer.. Would it be possible to add the above criteria?

I don't understand why you insist on sorting the data. Is the sample in post #1 representative of your data? The figures appear in descending order: Is this done by you or is this how the data comes in?

You could post representative data as it occurs and state the outcome you want to see, related that sample.
 
Upvote 0

Forum statistics

Threads
1,216,091
Messages
6,128,775
Members
449,468
Latest member
AGreen17

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