If you're lucky, it'll never happen to you. But odds are, if you choose to go beyond mutual funds and ETFs and include individual stocks in your portfolio, you'll eventually have one turn sour on you. What you do next can make the difference between a huge loss and a breathtaking gain -- or salvaging something from a dying company versus getting nothing at all.

When things go wrong
Lots of things can happen to make your stocks go down sharply. Here's a quick look at three examples:

  • Company-specific news. If something happens that directly hurts your company, then it's usually pretty obvious that you're going to take a hit. Anadarko Petroleum (NYSE: APC), for instance, has lost more than half of its value because of its 25% stake in the well responsible for the BP oil spill. The company is significantly smaller than BP and therefore has proportionally more to lose.
  • Industry or regional news. Sometimes, a more general news item affects not just your company but also an entire industry or region. For instance, ArcelorMittal (NYSE: MT) and Alcatel-Lucent (NYSE: ALU) arguably shouldn't see much direct fallout from the European financial crisis, but the potential long-term economic impact of sovereign debt woes and the huge European bailout package have made investors leery of growth prospects looking forward.
  • Throwing the baby out with the bathwater. Occasionally, the whole market will tank and take most stocks with it. In 2008, very few stocks survived the carnage of the market meltdown, yet many bounced back so strongly afterward that it was clear that the moves were irrational. Starbucks (Nasdaq: SBUX), for instance, got cut in half from March 2008 to March 2009 on the assumption that people would stop paying $4 for coffee. It nearly tripled in the following year.

How you should respond to a stock decline depends on which of these three situations you find yourself in.

Dealing with one stock
If a news item specific to your company is responsible for cratering the stock, then the first thing to do is to look at what happened and figure out what impact it will have on the company's financials. Often, investors will overreact and send prices far lower than they should.

For instance, in September 2008, Apple (Nasdaq: AAPL) shares lost nearly 18% in a single day after two analysts revised their forward earnings estimates for the company downward. Many feared that the recession would kill consumer demand in favor of cheaper products from competitors.

But those who weren't cowed by those false predictions were richly rewarded. Year-over-year earnings growth slowed in early 2009, but it never stopped. Now it's back with a vengeance.

Of course, with other companies, you might come to a different conclusion. The key, though, is not to panic-sell at the first sign of bad news. Often, what sounds like a disaster can turn out to be a buying opportunity.

When industries go bad
On the other hand, you'll often hear news that threatens an entire industry. For instance, financial stocks across the board have been dealing with many of the same issues, including toxic loans, derivatives exposure, and the prospects for financial reform.

But when you look back, you realize that the financial crisis actually benefited some companies at the expense of others. Washington Mutual died from its loan exposure, but JPMorgan Chase (NYSE: JPM) capitalized by grabbing its assets on the cheap, paying far less than it would have had WaMu accepted a buyout offer just months earlier. Similarly, Wachovia nearly collapsed under the weight of bad loans, but Wells Fargo (NYSE: WFC) came in to buy the ailing bank and cashed in on valuable tax writeoffs. If you sold those healthy banks during the financial crisis just because of the problems other banks were suffering, then you missed out on a huge rebound during 2009.

When bad news hits an entire industry, you'll always find winners and losers. If you own a winner, don't let the bad news sway your conviction.

Bad markets
Similarly, when the overall stock market falls, most stocks fall with it. Sure, during the 2008 bear market, some stocks, such as Wal-Mart and McDonald's, bucked the trend and went higher. But most of the time, a bad market will pull down even strong stocks.

In the long run, though, companies with good financial prospects will be rewarded. If the stocks you own are well placed to ride out bad times for the market as a whole, don't think about selling. But if you've speculated on good times to save a questionable stock, then think more strongly about looking for the exit.

Dealing with a fallen stock is one of the hardest things investors face. By staying cool and making rational decisions, though, you'll figure out how to make the best of a bad situation.

Tune in every Monday and Wednesday for Dan's columns on retirement, investing, and personal finance.