Creating a FIFO table with a series of buy and sell transactions based on date

lnumz

New Member
Joined
Jun 24, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello.

I am attempting to FIFO a series of buy and sell transactions into a semi-formatted output given there is other data I need to calculate for this. However, FIFO'ing the transactions is what I am after largely.

I've effectively given up on this being possible without the use of VBA.

I need transactions that I have laid out like this (these are all from the same security, I just randomized the data for example's sake so if the values don't seem right, no worries).:
Screen Shot 2020-06-24 at 9.25.37 AM.png


To Become something like this:
Screen Shot 2020-06-24 at 9.25.55 AM.png


As you can see, thus far I have created a semi-calculator-esque idea that will allow me to manually FIFO quite easy (IE it allows me to put the buy/sell in, and then tells me how much of each was used and displays the remainder such that I can carry it over myself and delete the order myself when it is complete) but, these lists often have hundreds of transactions. Any form of advice or help would be greatly appreciated.

Thanks!
 
You will need to change all of the occurances of "Sheet1" in the code with the name of your source sheet and Sheet2 in your destination sheet.
I recommend using REPLACE excel feature to get them all
This code will roll through each one, and factor in partial inventory for the next round.
You cannot just run it on the sample that you gave me as the Sell is higher than the Cost (as requested for testing)
Your costing on your summary page is prorated based on partial amounts as well.
I did not know how you calculated the exchange rate on your summary sheet so you will see a line of code that says
VBA Code:
Selection.Offset(0, 2).Value = 50 'change this to wherever you get this exchange rate from
You will need to tweak that line as well.

Hope this does what you wanted
 
Upvote 0

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
You will need to change all of the occurances of "Sheet1" in the code with the name of your source sheet and Sheet2 in your destination sheet.
I recommend using REPLACE excel feature to get them all
This code will roll through each one, and factor in partial inventory for the next round.
You cannot just run it on the sample that you gave me as the Sell is higher than the Cost (as requested for testing)
Your costing on your summary page is prorated based on partial amounts as well.
I did not know how you calculated the exchange rate on your summary sheet so you will see a line of code that says
VBA Code:
Selection.Offset(0, 2).Value = 50 'change this to wherever you get this exchange rate from
You will need to tweak that line as well.

Hope this does what you wanted

That is nothing short of wizardry. Here I was thinking my 3 weeks of VBA learning was capable of semi doing this, I have a long way to go. Thank you kindly.
 
Upvote 0

Forum statistics

Threads
1,213,482
Messages
6,113,908
Members
448,532
Latest member
9Kimo3

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