A friend gave me some money to invest for him. Since then I have also put more of my own money, in addition to the original I had when he gave me his money. I have been using his money together with mine to buy stocks. Now I want to sell his part and give him his share of profits. I am just confused because there has been a lot of buying and selling. Is there an easy way about going through this?
Track each trade
If he asked you to invest his money with certain objectives which resulted in you buying specific stocks for him with his money, then sell all the stocks which you bought with his money and the capital and profits to him. You may want to calculate the trading fees that you incurred while buying these specific stocks and taxes from the sale of these stocks, withholding them to over the trading fees that you have already paid and the taxes that you might still need to pay.
Black box approach
If you traded with his money no different than yours, then I would think of your investment account as a black box. Calculate the initial money that you both invested at the time you added his capital to the account, calculate how much it all is currently worth, then liquidate and return a percentage equal to that of his initial investment. You can account for trading fees and taxes, subtracting by the same percentage.
Let's suppose your friend gave your $100 and you invested all of it (plus your own money, $500) into one stock. Therefore, the total investment becomes $100 + $500 = $600.
After few months, when you want to sell the stock or give back the money to your friend, check the percentage of profit/loss. So, let's assume you get 10% return on total investment of $600.
Now, you have two choices. Either you exit the stock entirely, OR you just sell his portion.
If you want to exit, sell everything and go home with $600 + 10% of 600 = $660. Out of $660, give you friend his initial capital + 10% of initial capital. Therefore, your friend will get $100 + 10% of $100 = $110.
If you choose the later, to sell his portion, then you'll need to work everything opposite. Take his initial capital and add 10% of initial capital to it; which is $100 + 10% of $100 = $110. Sell the stocks that would be worth equivalent to that money and that's it.
Similarly, you can apply the same logic if you broke his $100 into parts. Do the maths.
If you have been a good steward of your friend's money this suggestion will not be too difficult.
Pay your friend what his money would have earned in the S&P 500 if you had just invested it in an index fund. Subtract 15% for long-term capital gains. You can use the ticker SPY to see what the price was on the day he gave you the money, versus the price today.
If you had helped your friend open an account for himself, you would have given him more than the returns on his money, you would have helped educate him on how to invest for himself.