Is there an online cost-basis calculator that automatically accounts for dividend re-investments and splits?
Google Finance portfolios take into account splits and cash deposits/withdrawals. Reinvestment creates a nightmare when it comes time to do taxes, sadly. Tons of annoying little transactions that happened automatically... Here's one article trying to answer your question: http://www.smartmoney.com/personal-finance/taxes/figuring-out-your-cost-basis-when-youve-lost-the-statements-9529/ You could also try this thing: http://www.gainskeeper.com/us/BasisProIndividual.aspx But I couldn't tell you if it would help. If it makes you feel better, brokerages are now required by the IRS to track your basis for you, so for new transactions and assets you shouldn't end up in this situation. Doesn't help with the old stuff ;-) Calculating and adjusting cost basis accurately is a daunting task, but there is a (paid) online tool, NetBasis, which will automatically calculate and adjust your cost basis.  It is used by brokerage firms and Fortune 500 companies and is available to the public.  Go to netbasis.com. All you need are the purchase and sale dates and shares of the stock or mutual fund and the system has the rest of the information, such as corporate actions (splits, spin-offs, etc), pricing, and dividends and it also will apply the appropriate IRS rules for inherited and gifted shares. The regulation also gives investors the option to choose calculation methods.  Not only does NetBasis automatically calculate the method you choose, it will also give the results for all options and allow you to choose the best result. NetBasis also provides you with detailed supporting documentation which shows all of the calculations and the adjustments in chronological order. NetBasis has data going back as far as 1925, so it will accurately calculate cost basis for your old American Telegraph and Telephone shares. NetBasis also handles complex investment scenarios such as wash sales, short sales, return of capital, etc. Moderator's note: Disclosure: The answerer's profile indicates they are affiliated with NetBasis.
I am not a tax professional, only an investment professional, so please take the following with a grain of salt and simply as informational guidance, not a personal recommendation or solicitation to buy/sell any security or as personal tax or investment advice. As Ross mentioned, you need to consult a tax advisor for a final answer concerning your friend's personal circumstances. In my experience advising hundreds of clients (and working directly with their tax advisors) the cost basis is used to calculate tax gain or loss on ordinary investments in the US. It appears to me that the Edward Jones description is correct. This has also been the case for me personally in the US with a variety of securities--stocks, options, futures, bonds, mutual funds, and exchange traded funds.  From the IRS: https://www.irs.gov/uac/about-form-1099b Form 1099-B, Proceeds From Broker and Barter Exchange Transactions A broker or barter exchange must file this form for each person: Edward Jones should be able to produce a 1099b documenting the gains/losses of any investments. If the 1099b document is confusing, they might have a gain/loss report that more clearly delineates proceeds, capital returns, dividends, and other items related to the purchase and sale of securities. Have you looked into GnuCash? It lets you track your stock purchases, and grabs price updates. It's designed for double-entry accounting, but I think it could fit your use case. You could create your own spreadsheet of Cash Flows and use the XIRR function in Excel: The formula is: Yes, add the stocks/mutual funds that you want and then you would just need to add all the transactions that you theoretically would have made. Performing the look up on the price at each date that you would have sold or bought is quite tedious as well as adding each transaction. Having all of the numbers you posted is a start. It's what you need to perform the calculation.  The final word, however, comes from the company itself, who are required to issue a determination on how the spin-off is valued. Say a company is split into two. Instead of some number of shares of each new company, imagine for this example it's one for one. i.e. One share of company A becomes a share each in company B and company C. This tell us nothing about relative valuation, right? Was B worth 1/2 of the original company A, or some other fraction? Say it is exactly a 50/50 split. Company A releases a statement that B and C each should have 1/2 the cost basis of your original A shares. Now, B and C may very well trade ahead of the stock splitting, as 'when issued' shares. At no point in time will B and C necessarily trade at exactly the same price, and the day that B and C are officially trading, with no more A shares, they may have already diverged in price. That is, there's nothing you can pull from the trading data to identify that the basis should have been assigned as 50% to each new share. This is my very long-winded was of explaining that the company must issue a notice through your broker, and on their investor section of their web site, to spell out the way you should assign your basis to each new stock. "You can calculate the ""return on investment"" using libreoffice, for example. Look at the xirr function. You would have 2 columns, one a list of dates (ie the dates of the deposits or dividends or whatever that you want to track, the last entry would be today's date and the value of the investment today. The xirr function calculates the internal rate of return for you. If you add money to the account, and the current value includes the original investment and the added funds, it will be difficult to calculate the ROI. If you add money by purchasing additional shares (or redepositing dividends by buying additional shares), and you only want to track the ROI of the initial investment (ignoring future investments), you would have to calculate the current value of all of the added shares (that you don't want to include in the ROI) and subtract that value from the current total value of the account. But, if you include the dates and values of these additional share purchases in the spreadsheet, xirr will calculate the overall IRR for you." "Re. question 2 If I buy 20 shares every year, how do I get proper IRR? ... (I would   have multiple purchase dates) Use the money-weighted return calculation: http://en.wikipedia.org/wiki/Rate_of_return#Internal_rate_of_return  where t is the fraction of the time period and Ct is the cash flow at that time period. For the treatment of dividends, if they are reinvested then there should not be an external cash flow for the dividend.  They are included in the final value and the return is termed ""total return"".  If the dividends are taken in cash, the return based on the final value is ""net return"". The money-weighted return for question 2, with reinvested dividends, can be found by solving for r, the rate for the whole 431 day period, in the NPV summation. Now annualising And in Excel" "(Value of shares+Dividends received)/(Initial investment) would be the typical formula though this is more of a percentage where 1 would indicate that you broke even, assuming no inflation to be factored. No, you don't have to estimate the share price based on revenues as I would question how well did anyone estimate what kind of revenues Facebook, Apple, or Google have had and will have. To estimate the value of shares, I'd likely consider what does my investment strategy use as metrics: Is it discounted cash flow, is it based on earnings, is it something else? There are many ways to determine what a stock ""should be worth"" that depending on what you want to believe there are more than a few ways one could go." Adjustments can be for splits as well as for dividends.  From Investopedia.com: Historical prices stored on some public websites, such as Yahoo!   Finance, also adjust the past prices of the stock downward by the   dividend amount. Thus, that could also be a possible factor in looking at the old prices. You can use a tool like WikiInvest the advantage being it can pull data from most brokerages and you don't have to enter them manually. I do not know how well it handles dividends though. Your investment is probably in a Collective Investment Trust. These are not mutual funds, and are not publicly traded. I.e. they are private to plan participants in your company. Because of this, they are not required* to distribute dividends like mutual funds. Instead, they will reinvest dividends automatically, increasing the value of the fund, rather than number of shares, as with dividend reinvestment. Sine you mention the S&P 500 fund you have tracks closely to the S&P Index, keep in mind there's two indexes you could be looking at: Without any new contributions, your fund should closely track the Total Return version for periods 3 months or longer, minus the expense ratio. If you are adding contributions to the fund, you can't just look at the start and end balances. The comparison is trickier and you'll need to use the Internal Rate of Return (look into the XIRR function in Excel/Google Sheets). *MFs are not strictly required to pay dividends, but are strongly tax-incentivized to do so, and essentially all do. I have found The DRiP Investing Resource Center to be a useful resource for more information about DRIP investing.  Moneypaper.com offers a list of companies offering both direct purchase options and dividend reinvestment plans. For those offering dividend reinvestment plans, but not direct purchase, you have the option of using a service to purchase your first shares to enroll in the DRIP program.  The tax paperwork for DRIPs is a pain due to the partial shares purchased over time when you have to figure out your own cost basis upon sale of shares , but a spreadsheet and a FIFO (first in first out) approach makes it not too much of a headache.   -MU "Generally if you are using FIFO (first in, first out) accounting, you will need to match the transactions based on the number of shares. In your example, at the beginning of day 6, you had two lots of shares, 100 @ 50 and 10 @ 52.  On that day you sold 50 shares, and using FIFO, you sold 50 shares of the first lot.  This leaves you with 50 @ 50 and 10 @ 52, and a taxable capital gain on the 50 shares you sold. Note that commissions incurred buying the shares increase your basis, and commissions incurred selling the shares decrease your proceeds.  So if you spent $10 per trade, your basis on the 100 @ 50 lot was $5010, and the proceeds on your 50 @ 60 sale were $2990.  In this example you sold half of the lot, so your basis for the sale was half of $5010 or $2505, so your capital gain is $2990 - 2505 = $485. The sales you describe are also ""wash sales"", in that you sold stock and bought back an equivalent stock within 30 days.  Generally this is only relevant if one of the sales was at a loss but you will need to account for this in your code.  You can look up the definition of wash sale, it starts to get complex. If you are writing code to handle this in any generic situation you will also have to handle stock splits, spin-offs, mergers, etc. which change the number of shares you own and their cost basis.  I have implemented this myself and I have written about 25-30 custom routines, one for each kind of transaction that I've encountered.  The structure of these deals is limited only by the imagination of investment bankers so I think it is impossible to write a single generic algorithm that handles them all, instead I have a framework that I update each quarter as new transactions occur." Dividend yield is a tough thing to track because it's a moving target.  Dividends are paid periodically the yield is calculated based on the stock price when the dividend is declared (usually, though some services may update this more frequently).   I like to calculate my own dividend by annualizing the dividend payment divided by my cost basis per share.  As an example, say you have shares in X, Co.  X issues a quarterly dividend of $1 per share and the share price is $100; coincidentally this is the price at which you purchased your shares. But a few years goes by and now X issues it's quarterly dividend of $1.50 per share, and the share price is $160. However your shares only cost you $100. Your annual yield on X is 6%, not the published 3.75%.  All of this is to say that looking back on dividend yields is somewhat similar to nailing jello to the wall.  Do you look at actual dividends paid through the year divided by share price?  Do you look at the annualized dividend at the time of issue then average those?  The stock price will fluctuate, that will change the yield; depending on where you bought your stock, your actual yield will vary from the published amount as well. "I keep spreadsheets that verify each $ distribution versus the rate times number of shares owned. For mutual funds, I would use Yahoo's historical data, but sometimes shows up late (a few days, a week?) and it isn't always quite accurate enough. A while back I discovered that MSN had excellent data when using their market price chart with dividends ""turned on,"" HOWEVER very recently they have revamped their site and the trusty URLs I have previously used no longer work AND after considerable browsing, I can no longer find this level of detail anywhere on their site !=( Happily, the note above led me to the Google business site, and it looks like I am ""back in business""... THANKS!"