dimanche 24 avril 2016

Subtract an amount from a cell until it reaches 0, then move and subtract from the next amount

Can you please assist me with the below? The objective of my excel project is that each time each time B is found in column A is minus the quantities of A till the quantity is reached.

Only values with A is where the quantities will be subtracted from. The next time it finds the next B , it will check any above A’s with remaining quantity and so.

enter image description here

I attempted the below aswell but was not successful .

=IF(A2="B",MAX(SUM($B$2:B2)-OFFSET(A2,0,1),0),"")

i was thinking of opting into a vba code.

For Example:

With the first “B” is the sequence above, the remaining balance is zero (0) because 300 -100 leaving zero of the quantity left. The remaining 200 will be taken off 250 leaving a balance of 50.

Aucun commentaire:

Enregistrer un commentaire