Distribution of a set value against variables

TheShoe56

New Member
Joined
Jun 19, 2023
Messages
2
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Sample Workbook.xlsx
ABCD
1WEEK-01EXPECTED VALUE
201-STORE5
302-STORE5
403-STORE5
504-STORE5
6
7
801-STORE_DELIVERY5
902-STORE_DELIVERY5
1003-STORE_DELIVERY2
1104-STORE_DELIVERY0
12
13
14TOTAL PRODUCT12
Sheet1


Hey everyone!

I'm working in Office 2016 and trying to build a formula that will take a set value and subtract that value against a set of requirements until the set value is zero. I attached a sample spreadsheet that better communicates what I am trying to do and the expected values.

Cells B2, B3, B4 and B5 contain the variable requirement. Cell B14 has the set value. I want to meet the needs of stores 01 first, 02 second, 03 third, and 04 last. My expected returns are in cells D8, D9, D10, and D11.

Any advice on improving what I am searching for, resources, etc., would be greatly appreciated!

Have a great day!
 

Excel Facts

What do {} around a formula in the formula bar mean?
{Formula} means the formula was entered using Ctrl+Shift+Enter signifying an old-style array formula.
Welcome! This may need to be revised depending on a couple of things: I see WEEK-01 in the column heading. Will this be repeated for various weeks? Will your list of results appear in a table that is always the same order as the source information, or might it be different. Right now, I'm extracting the relevant portion of the text string to match with the source table's 1st column.
Book2
ABCD
1WEEK-01EXPECTED VALUE
201-STORE5
302-STORE5
403-STORE5
504-STORE5
6
7
801-STORE_DELIVERY5
902-STORE_DELIVERY5
1003-STORE_DELIVERY2
1104-STORE_DELIVERY0
12
13
14TOTAL PRODUCT12
TheShoe56
Cell Formulas
RangeFormula
D8:D11D8=MIN(MAX($B$14-SUM($D$7:D7)),INDEX($B$2:$B$5,MATCH(LEFT(A8,FIND("_",A8)-1),$A$2:$A$5,0)))
 
Upvote 1
Solution
Thank you very much for taking the time to give me feedback! The data will be repeated over 30 weeks, but each week will remain static and not influenced by the previous week's data.

As far as the store numbering, that data would also remain static.

One issue while implementing your solution that I should have considered is what would happen if I had excess product over store requirements.

I'm reviewing the MIN, and MAX functions you provided (thank you!) and working to build on your solution. I'll give a follow-up after some tinkering, someone else might find value in it as well!

Thank you again for the assistance!
 
Upvote 0
Thanks for the feedback. The reason for my questions about the order of the store listings and whether multiple weeks might be involved becomes clearer when considering the following expanded example. Here we have a "TOTAL PRODUCT" that varies for each week and the order of the stores and weeks in the results table (prioritized allocations) is not the same as in the source table. This requires lookups for the Total Product value as well as matching to determine the appropriate row and column to use in the source table.
Book2
ABCDEF
1WEEK-01WEEK-02WEEK-03WEEK-04
201-STORE5312
302-STORE5222
403-STORE5432
504-STORE1542
6
7TOTAL PRODUCT121345
8
9Prioritized Allocations
10WEEK-01WEEK-02WEEK-04
1101-STORE_DELIVERY532
1202-STORE_DELIVERY522
1304-STORE_DELIVERY151
1403-STORE_DELIVERY130
TheShoe56
Cell Formulas
RangeFormula
D11:F14D11=MIN(MAX(INDEX($B$7:$E$7,MATCH(D$10,$B$1:$E$1,0))-SUM(D$10:D10)),INDEX($B$2:$E$5,MATCH(LEFT($A11,FIND("_",$A11)-1),$A$2:$A$5,0),MATCH(D$10,$B$1:$E$1,0)))
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,123,009
Members
449,093
Latest member
ikke

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