Sum to a max value based on ranking

Sjloutz

New Member
Joined
May 11, 2021
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi - this is my first post. I’ve generally been successful in searching for an answer to my questions but I haven’t been able to find anything that seems to cover my need.

I have a worksheet that lists each line as a percentage of a total volume. In another column, I have a list of values. I need a column to assign these values by the descending rank of the other column until their sum meets a specific number.

I use sumifs a lot but am having a hard time applying it with the rank criteria. I’m actually not sure if it’s possible but I feel like I’m probably over thinking it.

thanks!
example:
Total sum =12
Rank Volume Result
6 4
3. 2 2
4. 3
2. 6 6
5. 4
1 4 4
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Welcome to the MrExcel forum!

How about:

Book1
ABCDE
1RankVolumeResultTotal sum
264 12
3322
443 
5266
654 
7144
Sheet4
Cell Formulas
RangeFormula
C2:C7C2=IF(SUMIF(A:A,"<="&A2,B:B)<=E$2,B2,"")
 
Upvote 0
Solution
THIS IS PERFECT! Thank you so much. I completely overlooked using an &.
 
Upvote 0
Welcome to the MrExcel forum!

How about:

Book1
ABCDE
1RankVolumeResultTotal sum
264 12
3322
443 
5266
654 
7144
Sheet4
Cell Formulas
RangeFormula
C2:C7C2=IF(SUMIF(A:A,"<="&A2,B:B)<=E$2,B2,"")
I want to do something almost identical to this, except I would want to calculate exactly to cell E2. Currently, it will sum up to the last full value of column B without going above E2, but I would want to use a partial value from column B.
 
Upvote 0
How about:

Book1
ABCDE
1RankVolumeResultTotal sum
264 17
3322
4433
5266
6542
7144
Sheet8
Cell Formulas
RangeFormula
C2:C7C2=IFERROR(1/(1/MEDIAN(0,B2,$E$2-SUMIF(A:A,"<"&A2,B:B))),"")
 
Upvote 0
How about:

Book1
ABCDE
1RankVolumeResultTotal sum
264 17
3322
4433
5266
6542
7144
Sheet8
Cell Formulas
RangeFormula
C2:C7C2=IFERROR(1/(1/MEDIAN(0,B2,$E$2-SUMIF(A:A,"<"&A2,B:B))),"")
This worked absolutely perfectly! I really appreciate the help!
I had my doubts that you'd answer this quickly to such an old thread, but you really came through. I actually made my own thread to ask my variation of this. You can pretty much copy your answer over to it if you're interested in getting another solution under your belt.
 
Upvote 0
Well, I am a bit of an old-timer, but you did get a bit lucky that I happened to notice it so soon. Glad I could help! :cool:

I'll go leave a comment in the other thread just so other people won't spend time working on it. Opening up a new thread is the recommended method of asking a new question, just in case someone doesn't happen to notice a new message on a very old thread.
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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