cumulative stock without negatives

bullit_nl

Active Member
Joined
Jun 27, 2002
Messages
280
Hi,

I'm trying to do a cumulative stock count vs needed per day.
Example
A1 is quantity need to be in stock
B1 is quantity incoming
C1 is difference between B1 and A1
D2 I want the cumulative total stock per day (copy down)
E2 I want the cumulative over stock per day (copy down)

This works well as long there's a overstock. But once the is a number of continues days with negative stock I don't want the see the cumulative anymore because negatives will be resolved daily.
How can I make a formula that I can copy down that shows me the cumulative over stock results until I run into a negative stock and then continues again on overstock?

Thank you

Example data:

100​
500​
400​
400
150​
1.000​
850​
1.4001.250
200​
1.500​
1.300​
2.7502.550
250​
2.000​
1.750​
4.5504.300
300​
2.500​
2.200​
6.8006.500
350​
3.000​
2.650​
9.5009.150
400​
3.500​
3.100​
12.65012.250
450​
4.000​
3.550​
16.25015.800
500​
4.500​
4.000​
20.30019.800
550​
5.000​
4.450​
24.80024.250
600​
5.500​
4.900​
29.75029.150
650​
6.000​
5.350​
35.15034.500
700​
6.500​
5.800​
41.00040.300
10.000​
7.000​
-3.000​
47.30037.300
20.000​
7.500​
-12.500​
44.80024.800
30.000​
8.000​
-22.000​
32.8002.800
40.000​
8.500​
-31.500​
11.300-28.700
50.000​
9.000​
-41.000​
-41.0000
60.000​
9.500​
-50.500​
-50.5000
70.000​
10.000​
-60.000​
-60.0000
80.000​
10.500​
-69.500​
-69.5000
90.000​
11.000​
-79.000​
-79.0000
200.000​
225.000​
25.000​
25.000
225.000​
250.000​
25.000​
275.00050.000
250.000​
275.000​
25.000​
325.00075.000
275.000​
300.000​
25.000​
375.000100.000
300.000​
325.000​
25.000​
425.000125.000
325.000​
350.000​
25.000​
475.000150.000
350.000​
375.000​
25.000​
525.000175.000
375.000​
400.000​
25.000​
575.000200.000
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Something like this?
Book2
ABCDE
2100500400500400
3150100085014001250
42001500130027502550
52502000175045504300
63002500220068006500
73503000265095009150
8400350031001265012250
9450400035501625015800
10500450040002030019800
11550500044502480024250
12600550049002975029150
13650600053503515034500
14700650058004100040300
15100007000-30004730037300
16200007500-125004480024800
17300008000-22000328002800
18400008500-3150011300-28700
19500009000-41000-410000
20600009500-50500-505000
217000010000-60000-600000
228000010500-69500-695000
239000011000-79000-790000
242000002250002500022500025000
252250002500002500027500050000
262500002750002500032500075000
2727500030000025000375000100000
2830000032500025000425000125000
2932500035000025000475000150000
3035000037500025000525000175000
3137500040000025000575000200000
Sheet3
Cell Formulas
RangeFormula
C2:C31C2=B2-A2
D2:D31D2=IF(E2=0,C2,E2+A2)
E2:E31E2=IF(AND(E1<=0,C2<0),0,N(E1)+C2)
 
Upvote 0
Hello Jason,

Exactly something like that! Super.....works like a charm. Thank you for your time and effort to help me out on this.
I have also made a percentage difference in column F2 (copy down):

Formula:
E2/A2 %

But if the result is 0 then I would like to get the percentage result of D2/A2.
 
Upvote 0
Maybe
Excel Formula:
=IF(E2=0,D2,E2)/A2
 
Upvote 0
Hi Fluff,

Yes it works but I don't understand the formula :)
How does it know when it has to do E2/A2 or D2/A2?

IF E2 = 0 then D2/A2 otherwise E2/A2?

And do I get the right percentage if D is a negative number and A is a positive number?
 
Upvote 0
The first part of the formulaIF(E2=0,D2,E2) returns either D2 or E2 depending on if E2 is 0 & then divides that by A2
 
Upvote 0
Ok clear thank you for the explanation.
Do you know about the negative vs positive percentage outcome?
 
Upvote 0
I've no idea if you get the right result, as I have no idea what you expect to get. ;)
 
Upvote 0

Forum statistics

Threads
1,223,713
Messages
6,174,043
Members
452,542
Latest member
Bricklin

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