Recursive Calculation Issue

wtsabo

New Member
Joined
Mar 3, 2010
Messages
39
Hello,
After so many years of saying that there was no need to use VBA, I think I've reached my breaking point. Any help will be greatly appreciated! :)
Being a beginning at VBA, can someone please assist?


I am trying to calculate the sum of a string of products under certain limitations. This is what I need to do:

Transaction Currency = User Defined
Buy Units = User DefinedCloseValue = 0
RemainingUnits = Buy Units

1. Find Sell Order of Same Currency
2. RemainingUnits > Sell Units?
True:
SellValue = (Sell Units * Sell Price for Transaction)
CloseValue = CloseValue + SellValue
SellValue = 0
- RemainingUnits = (Buy Units - Sell Units)
- Return to Step 1
False: 0 < Sell Units < Buy Units
SellValue = (Sell Units * Sell Price)
CloseValue = CloseValue + SellValue
Stop

Output = CloseValue before stop

I would then need this to repeat in the cell below so that it will not pick up any of the prior sell transactions.

Thank you for any help
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Forum statistics

Threads
1,214,960
Messages
6,122,479
Members
449,088
Latest member
Melvetica

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