I understand that there are many websites on the Internet which talks about calculating the return on your investment but many times it is not exactly what you area trying to look for. For example, most of the websites will show you how to calculate your ROI (Return on Investment) using a very typical textbook type example which generally is not very helpful although it can serve as a good start to understand the basic concept.
I have specifically compiled some links that shows how we can calculate ROI for a scenario in which involves multiple transactions (Inflow and Outflow) that do not occur at regular intervals. In short, we need to account for time value of money for the exact number of days for which your money has been into the account. This involves using the XIRR tool which is available in MS Excel. XIRR tool is different than IRR in many ways. For example, the use of IRR tool in Excel assumes that the transaction occurs at regular intervals whereas if you use XIRR that is no longer a constraint i.e. the money can go in and go out at any time during your total investment period ( See point 3 for details)
Here are some links that shows you how you can use XIRR tool to calculate your ROI on for your portfolio.
1) This one is a pretty solid explanation on XIRR tool and explains difference between a portfolio which has only internal transactions versus a portfolio which has some deposits and withdrawals over a period of time.
2) An example from Microsoft’s website which gives basic explanation about this function.
3) If you are wondering what is the difference between XIRR and IRR functions then this is a good page.
I will add more stuff on this page when I get a chance.
Hope this is helpful.