Everywhere, companies are reporting bad news. Union Pacific (NYSE:UNP) saw its profit fall 18% in the first quarter, with possible plans to cut more jobs. Caterpillar (NYSE:CAT) lost money for the first time in 17 years. Boeing (NYSE:BA) saw its net income fall by half.

In the face of such news, and considering that there's much more of it from hundreds of other companies, many investors are blanching. They're breaking out in a cold sweat and clutching their dollars tightly. They're telling themselves that this is a scary and bad time to be in the stock market, that they're better off waiting until things calm down before they jump back in.

Other investors already owned some of these companies, and they sold upon hearing this news. Some of these companies saw their shares drop sharply when their financial results were released. Shares of Eaton (NYSE:ETN), for example, dropped 10% on the company's disappointing first-quarter results.

But other companies saw the reverse happen. Sherwin-Williams (NYSE:SHW) shares, for example, surged 10% even after the company reported a 50% fall in earnings.

What's going on?
The reason why some stocks rise while others fall in response to bad news is that in many cases, investors already expected these firms to suffer big losses. With our economy hobbling along lately, it's silly to expect that companies like Black & Decker (NYSE:BDK) will see tools flying off the shelves, or that UPS (NYSE:UPS) will see big growth in its delivery volume. So, if a company's results aren't quite as bad as expected, that can give its stock a boost.

Also, what looks like bad news can sometimes be good news for investors. Laying off 10,000 people is terrible news for workers, but if it makes a company leaner and more nimble, it might be a positive for the stock.

What to do
The key is to avoid acting automatically whenever we see what looks like bad news. When companies are punished for reporting a bad quarter, look more closely to see whether the market has overreacted. If it looks like they have, then we may well be looking at a bargain opportunity -- one that won't necessarily last all that long.

At our flagship Motley Fool Stock Advisor newsletter, Fool co-founders Tom and David Gardner are always looking for smart stock bargains. Find out what they're recommending now with a free 30-day trial.

Longtime Fool contributor Selena Maranjian does not own shares of any companies mentioned in this article. Sherwin-Williams is a Motley Fool Stock Advisor selection. United Parcel Service is a Motley Fool Income Investor recommendation. Try our investing newsletters free for 30 days. The Motley Fool is Fools writing for Fools.