Hi all,
I can (I actually have) written code) that loops through every investment in A, checks if any existing investment in B needs to be added to it and then checks if anything from C needs to be subtracted from A (via lookup). It then adds this to the output.
Then the code goes through any new investment in B (that isn’t in A) and adds it to the output as a new investment.
It somehow works but it seems convoluted. Is there an easier way to combine these three data sets? (A + B – C) that show the output? (with anything from A that is 100% sold isn’t shown in the results).
I’ve attached an example of the problem and below it the manual solution (well I created an example XLS & was going to attach it but system says I don't have that permission so I can't).
Any help ideas would be much appreciated.
If the way I’m doing it is the best way, then so be it. I’m also keen to learn smarter ways of doing these things (can also cut code looping time I imagine).
Cheers
Tim
- I have a series of current investments in columns (fields = InvestmentName, Units, Value).
- I then have a series of newly acquired investments in columns (fields = InvestmentName, Units, Value). These may be additions to the current investments or new investments.
- I then have a series of sold investments in columns (fields = InvestmentName, Units, Value).they have to be in the current investments (you can’t sell what you don’t have nor can you sell more than you have).
I can (I actually have) written code) that loops through every investment in A, checks if any existing investment in B needs to be added to it and then checks if anything from C needs to be subtracted from A (via lookup). It then adds this to the output.
Then the code goes through any new investment in B (that isn’t in A) and adds it to the output as a new investment.
It somehow works but it seems convoluted. Is there an easier way to combine these three data sets? (A + B – C) that show the output? (with anything from A that is 100% sold isn’t shown in the results).
I’ve attached an example of the problem and below it the manual solution (well I created an example XLS & was going to attach it but system says I don't have that permission so I can't).
Any help ideas would be much appreciated.
If the way I’m doing it is the best way, then so be it. I’m also keen to learn smarter ways of doing these things (can also cut code looping time I imagine).
Cheers
Tim