Match dates to amount vba

fkaaelaursen

New Member
Joined
Sep 16, 2019
Messages
1
Hi,

I'm quite new to excel modelling, and I've been asked to create a model of controlling an employee warrant program.

I'm in trouble of solving the following situation:

An employee are exercising:
4/6 - 20 warrants
6/6 - 20 warrants
18/6 - 7 warrants

When the warrants are exercised they are converted to shares that will be sold by the broker.

The broker sells:
4/6 - 16 shares
5/6 - 4 shares
6/6 - 20 shares
18/6 - 7 shares

Now that I know all the sell transactions, I need to allocate the correct exercise date to the sell trades for tax purposes, for instance:

4/6 - 16 shares
4/6 - 4 shares
6/6 - 20 shares
18/6 - 7 shares

We are using a FIFO principle, first shares exercised are first shares sold.
How can I create a vba sub function to sum shares sold until first exercise amount is met e.g. 20 and then allocate the first exercise date to these trades? The code should then sum shares sold that are not already given an exercise date until second exercise amount is met e.g. 20 and so on.

I really hope you can help me guide me in the right direction as this is the last bit of the model that I need to complete.
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off

Forum statistics

Threads
1,224,819
Messages
6,181,153
Members
453,021
Latest member
Justyna P

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