Substract / add ONLY after checking several colums if its the same

Ignore

New Member
Joined
Jul 4, 2013
Messages
46
I'm currently making an excel file for someone. But I'm quite stuck.
Here's the problem.

SizeQualityorder supplierorder customerStock
5X5High20015050
5X5High505050
6X9Low1002575
5X5High0500

<tbody>
</tbody>

I can't find the formula for stock. It MUST check size and quality before being able to substract / add. The column Stock must know wh ere to substract. Only if quality and size is the same.
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
Hi

in E2

Code:
=SUMIFS(C$2:C2,A$2:A2,A2,B$2:B2,B2)-SUMIFS(D$2:D2,A$2:A2,A2,B$2:B2,B2)

or Excel 2003 or previous

Code:
=SUMPRODUCT(C$2:C2,--(A$2:A2=A2),--(B$2:B2=B2))-SUMPRODUCT(D$2:D2,--(A$2:A2=A2),--(B$2:B2=B2))

Hope it helps
 
Upvote 0
Is it possible for the whole excel file. From top to bottom?

Edit: it's not working for me :(
 
Last edited:
Upvote 0
I Pmed you the same :)

Thanks for you help! I appreciated it very much!

If a new order appears. the stock goes to 0 and only the last one will show a number?

for example:



SizeQualityorder supplierorder customerStock
5X5High2001500
5X5High50500
6X9Low100250
5X5High0500

5X5High050-50
6X9Low250100


<tbody>
</tbody>
 
Upvote 0
Thanks :)
What I mean. Is it possible that only the last one shows how much there's in stock.
Now with 5x5 you can se there are 50 too few but in the rows above you can see 0, 50 and 50. Is it possible that the rows above becomes '0'.
So people can only see the LAST stock?
 
Upvote 0
Hi, thanks for the feedback

In E2 you could try

Code:
=(SUMIFS(C$2:C$1000,$A$2:$A$1000,A2,$B$2:$B$1000,B2)-SUMIFS($D$2:$D$1000,$A$2:$A$1000,A2,$B$2:$B$1000,B2))*(COUNTIFS($A$2:A2,A2,$B$2:B2,B2)=COUNTIFS($A$2:$A$1000,A2,$B$2:$B$1000,B2))

Hope that helps
 
Upvote 0
Gonna test it out :) Gonna let you know if it works :D


Thank you so much :)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,651
Messages
6,120,738
Members
448,988
Latest member
BB_Unlv

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