Stuck in an OFFSET Circular Reference Loop in a Variable Supply/Demand Drawdown Analysis

jjohns829

New Member
Joined
Dec 18, 2020
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I've got quarterly demand and supply. I need to know how many quarters it will take for the supply to meet each demand

C2 is initial demand (followed by quarterly demand for next in C6) and E2 is initial supply (followed by quarterly supply)

It takes five quarters for the cumulative supply, SUM(E2:E6), to meet the demand,C2

There is leftover demand, SUM(E2:E6-C2), 323,487-276,459=47,028 that needs to be accounted against quarters supply and directly impacts the quarterly drawdown time dynamically column G.

The issue arises when column D becomes negative.

The negative value in represents additional supply that needs to be accounted for in E20 and so forth down column E, a surplus supply gets added to the next quarter's supply.

I used =IFERROR(MATCH(D6,SUBTOTAL(9,OFFSET(OFFSET($E$2,SUM($F$2:F5),0),,,ROW(E6:$E$633)-ROW(E6))),1),1) to calculate the drawdown time required in column F and adjusted each each drawdown time for the previous quarter's required drawdown time, column G.

For reference, I color coded how the above formula works.
 

Attachments

  • Screenshot 2020-12-18 070315.png
    Screenshot 2020-12-18 070315.png
    96.3 KB · Views: 7
  • Screenshot 2020-12-18 070551.png
    Screenshot 2020-12-18 070551.png
    63.9 KB · Views: 7

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Hi,,

If going through the details i have drawn a sample data using my own helper columns.
If this is what you are looking for than it could be done without helper too.

Book1
ABCDEFGHIJKL
1Helper ColumnCummulative QuarterQuarter
2Cumulative DemandSupplyCumulative SupplyIf EqualsCondition 30
3FY2021Q127645927645933018330180555
4Q2027645959007920250550
5Q30276459918911839160550
6Q40276459551032390190550
7FY2122Q1114357390816984743374930661
8Q21602415510571533534908460771
9Q38802963908614824063908607870
10Q4142706781792691587082440992
11FY2223Q132171211035041235938318370000
12Q245079415542988318370000
13Q324764618019448318370000
14Q418019448318370000
15FY2324Q118019448318370000
16Q218019448318370000
17Q318019448318370000
18Q418019448318370000
19
20
Sheet1
Cell Formulas
RangeFormula
H3:H18H3=MAX(IF(IF(D3=$F$3:$F$18,1,0)=1,ROW($F$3:$F$18)-ROW($F$3)+1,0))
I3:I18I3=IFERROR(AGGREGATE(15,6,1/(1/(IF(D3<$F$3:$F$18,1,0)*(ROW($F$3:$F$18)-ROW($F$3)+1))),1),0)
K3:K18K3=IF(H3>0,H3,I3)
L3:L18L3=IF(K3-K2<0,0,K3-K2)
E9E9=140966+7274
G9G9=D9-F9
D3:D18D3=SUM($C$3:C3)
F3:F18F3=SUM($E$3:E3)
 
Upvote 0
Hi,,

If going through the details i have drawn a sample data using my own helper columns.
If this is what you are looking for than it could be done without helper too.

Book1
ABCDEFGHIJKL
1Helper ColumnCummulative QuarterQuarter
2Cumulative DemandSupplyCumulative SupplyIf EqualsCondition 30
3FY2021Q127645927645933018330180555
4Q2027645959007920250550
5Q30276459918911839160550
6Q40276459551032390190550
7FY2122Q1114357390816984743374930661
8Q21602415510571533534908460771
9Q38802963908614824063908607870
10Q4142706781792691587082440992
11FY2223Q132171211035041235938318370000
12Q245079415542988318370000
13Q324764618019448318370000
14Q418019448318370000
15FY2324Q118019448318370000
16Q218019448318370000
17Q318019448318370000
18Q418019448318370000
19
20
Sheet1
Cell Formulas
RangeFormula
H3:H18H3=MAX(IF(IF(D3=$F$3:$F$18,1,0)=1,ROW($F$3:$F$18)-ROW($F$3)+1,0))
I3:I18I3=IFERROR(AGGREGATE(15,6,1/(1/(IF(D3<$F$3:$F$18,1,0)*(ROW($F$3:$F$18)-ROW($F$3)+1))),1),0)
K3:K18K3=IF(H3>0,H3,I3)
L3:L18L3=IF(K3-K2<0,0,K3-K2)
E9E9=140966+7274
G9G9=D9-F9
D3:D18D3=SUM($C$3:C3)
F3:F18F3=SUM($E$3:E3)
Hi CA_Punit,

This looks good, and I think it'll accomplish my goa, thanks! I do have a question, though, I'm not sure I get the formulas in E9 and G9. Will those have to be manually inseryaed as my raw data increases in scope?

Best,
Matt
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,752
Members
448,989
Latest member
mariah3

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