Need negative value to return exact value, and not accumulative value

Goddess

Board Regular
Joined
Dec 3, 2015
Messages
94
Office Version
  1. 2019
Platform
  1. Windows
Hi,


Date file (Sheet1)

ABCDEFGH
1​
InsertionStartMayJunJulAugSepOct
2​
Needed50202020202020
3​
4​
Stock000000
5​
Total3010-10-30-50-70
Basically, C5=B2+C4-C2, D5=C5+C4-D2 and so forth


The result I want is, if it's >0, then it will return 10, but if it's <0, then it will only return the actual 'short' amount, ie, May and Jun is 10 each, Jul is (10), Aug is (20), etc.



Also, in Sheet2, after each month there will be a blank column for remarks. Anyway to copy the formula across, other than key in manually?

Result file (Sheet2)

ABCDEFGHIJKLMN
1​
RequirementMayJunJulAugSepOct
2​
1010(10)(20)(20)(20)

Thanks!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
i would use a lookup on the 2nd sheet
Also
=($C$3+SUM($D$5:D5))-SUM($D$3:D3)
Should be a formula that can copy across for total
BUT WHY is August -20
When the result is -30

I have used TEXT as shown for the MONTH - BUT if real dates , then need to be the same in both sheets

chemistry_v1.xlsx
ABCDEFGHI
1ABCDEFGH
21InsertionStartMayJunJulAugSepOct
32Needed50202020202020
43
54Stock000000
65Total3010-10-30-50-70
Sheet5
Cell Formulas
RangeFormula
D6:I6D6=($C$3+SUM($D$5:D5))-SUM($D$3:D3)


And then on a seperate sheet
chemistry_v1.xlsx
ABCDEFGHIJKL
1MayJunJulAugSepOct
210#N/A10#N/A-10#N/A-30#N/A-50#N/A-70
3
4
5
6The result I want is, if it's >0, then it will return 10, but if it's <0, then it will only return the actual 'short' amount, ie, May and Jun is 10 each, Jul is (10), Aug is (20), etc.
7
8
9
10
11
12
13
14
15
Sheet6
Cell Formulas
RangeFormula
B2:L2B2=IF(INDEX(Sheet5!$D$6:$I$6,MATCH(Sheet6!B1,Sheet5!$D$2:$I$2,0))>0,10,INDEX(Sheet5!$D$6:$I$6,MATCH(Sheet6!B1,Sheet5!$D$2:$I$2,0)))
 
Upvote 0
i would use a lookup on the 2nd sheet
Also
=($C$3+SUM($D$5:D5))-SUM($D$3:D3)
Should be a formula that can copy across for total
BUT WHY is August -20
When the result is -30

I have used TEXT as shown for the MONTH - BUT if real dates , then need to be the same in both sheets

chemistry_v1.xlsx
ABCDEFGHI
1ABCDEFGH
21InsertionStartMayJunJulAugSepOct
32Needed50202020202020
43
54Stock000000
65Total3010-10-30-50-70
Sheet5
Cell Formulas
RangeFormula
D6:I6D6=($C$3+SUM($D$5:D5))-SUM($D$3:D3)


And then on a seperate sheet
chemistry_v1.xlsx
ABCDEFGHIJKL
1MayJunJulAugSepOct
210#N/A10#N/A-10#N/A-30#N/A-50#N/A-70
3
4
5
6The result I want is, if it's >0, then it will return 10, but if it's <0, then it will only return the actual 'short' amount, ie, May and Jun is 10 each, Jul is (10), Aug is (20), etc.
7
8
9
10
11
12
13
14
15
Sheet6
Cell Formulas
RangeFormula
B2:L2B2=IF(INDEX(Sheet5!$D$6:$I$6,MATCH(Sheet6!B1,Sheet5!$D$2:$I$2,0))>0,10,INDEX(Sheet5!$D$6:$I$6,MATCH(Sheet6!B1,Sheet5!$D$2:$I$2,0)))
Hi, August will be 20 as I need the actual shortfall, not accumulated from previous months.

Sheet1 will show the accumutated value throughout the months, whereas Sheet2 will show the actual amount that I need.

Thanks!
 
Upvote 0
I think this is what you need
BUT maynot - I think it needs you to try a few different values - adding stock etc as i'm not sure it will work in all cases

i have added a helper row to calculate the shortfall
This helper row - difference between previous month if the amount is below 0, otherwise if > 0 then 10
This can be hidden if not wanting on the same sheet - but that seemed the best way, although I'm sure ian be done with various lookups - I look into that and reply

chemistry_v1.xlsx
ABCDEFGHI
1ABCDEFGH
21InsertionStartMayJunJulAugSepOct
32Needed50202020202020
43
54Stock000000
65Total3010-10-30-50-70
7
8Helper Shortfall1010-20-20-20-20
Sheet5
Cell Formulas
RangeFormula
D6:I6D6=($C$3+SUM($D$5:D5))-SUM($D$3:D3)
D8:I8D8=IF(D6>0,10,D6-C6)


AND for the separate sheet, still used a lookup , to lookup the month and return the results of the helper column


chemistry_v1.xlsx
BCDEFGHIJKL
1MayJunJulAugSepOct
210 10 -20 -20 -20 -20
3
4
5
6The result I want is, if it's >0, then it will return 10, but if it's <0, then it will only return the actual 'short' amount, ie, May and Jun is 10 each, Jul is (10), Aug is (20), etc.
7
8
9
10
11
12
13
14
15
Sheet6
Cell Formulas
RangeFormula
B2:L2B2=IFERROR(INDEX(Sheet5!$D$8:$I$8,MATCH(Sheet6!B1,Sheet5!$D$2:$I$2,0)),"")
 
Upvote 0
Hi Thanks!

However, for July (F6), the result should be -10, as that is the actual shortfall for the month. This is where I'm stuck...
 
Upvote 0
sorry , i'm confused now , and not following
However, for July (F6), the result should be -10, as that is the actual shortfall for the month.
F6 is -10 on my posts on the Total Row

F8 Helper column on that sheet "Shortfall" is -20

F2 Shortfall on the 2nd sheet is -20

can you give the expected results again , and the reason calculation, if only in words
 
Upvote 0
sorry , i'm confused now , and not following

F6 is -10 on my posts on the Total Row

F8 Helper column on that sheet "Shortfall" is -20

F2 Shortfall on the 2nd sheet is -20

can you give the expected results again , and the reason calculation, if only in words
Hi,

The expected result I want on Sheet2 is as per my 1st post. The logic is, if the result is more than 0 (meaning I still have stock on hand), I will only order 10 pcs for that month. Hence, if the result is >0, it should return 10. However, if the stock falls below 0, I only need to order as per the shortfall for that month. Hence, I need the actual shortfall for that particular month.

So in my example below, July's shortfall is -10, August is -20 and so forth.

Hope I'm not confusing you :)


ABCDEFGHIJKLMN
1RequirementMayJunJulAugSepOct
21010(10)(20)(20)(20)
 
Upvote 0
can you add some stock , row 4 - and then expected results , for various months , so I can work out the full formulas for various scenarios
 
Upvote 0
Hi! Sorry for the late response. I managed to work it out. Not sure if it makes sense or not :)

BCDEFGHIJK
2​
InsertionStartMayJunJulAugSepOctNovDec
3​
Needed506020502030203020
4​
5​
Stock In401004006000
6​
Total3020-30-10-400-30-50

Result

ABCDEFGH
1​
MayJunJulAugSepOctNovDec
2​
10​
10​
-30​
-10​
-30​
10​
-30​
-20​

Formula I used on A2 (for the month of May)

=IFS(D6>=0,10,AND(D6<0,C6>=0),D6,AND(D6<0,C6<0,D5<=0),-D3,AND(D6<0,C6<0,D5>0),C6+D5-D3)
 
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,750
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