Subtract Cumulative Total until it reach zero with FIFO excel creation

cmkong87

New Member
Joined
Aug 8, 2019
Messages
1
Hi, i'm trying to create some subtract formula, but no idea how should i do it, the table below would show the result i desire:

[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD][/TD]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]DATE[/TD]
[TD]STOCK ITEMS NAME[/TD]
[TD]COST PER STOCK (IN USD)[/TD]
[TD]QUANTITY OF STOCKS[/TD]
[TD]CUMULATIVE/ BALANCE OF STOCKS[/TD]
[TD]REMARK[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]1/1/2019[/TD]
[TD]XYZ[/TD]
[TD]USD 1[/TD]
[TD]1000[/TD]
[TD]1000[/TD]
[TD]BUY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]15/1/2019[/TD]
[TD]XYZ[/TD]
[TD]USD 1[/TD]
[TD](500)[/TD]
[TD]500[/TD]
[TD]SELL[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]4[/TD]
[TD]31/1/2019[/TD]
[TD]XYZ[/TD]
[TD]USD 2[/TD]
[TD]1000[/TD]
[TD]1500[/TD]
[TD]BUY[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]5[/TD]
[TD]2/2/2019[/TD]
[TD]XYZ[/TD]
[TD]USD ???[/TD]
[TD](-1500)[/TD]
[TD]0[/TD]
[TD]SELL[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]

[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]


For ROW 5, as i sell the entire stock, i need the First 500 cost at USD1, the remaing 1,500 at USD2, so how can i create and present an automate formula in the excel table?
Thanks.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

Forum statistics

Threads
1,223,898
Messages
6,175,274
Members
452,628
Latest member
dd2

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