One would think the market would have been staggering lately, given fretful economic issues such as Washington's fiscal battles, rising food prices, and continued weakness of many consumers' spending power (which will surely be worsened by higher prices and pinched take-home pay from the payroll tax hike).

Oddly enough, though, the market's been doing some strangely euphoric things. Take last week's big market news: The S&P 500 hit 1500 for the first time in five years.

Many investors may be wondering how to navigate this crazy market. It's tempting either to buy into such a rally because everybody's doing it, or to decide to avoid it because so many stocks are probably overpriced.

Here's one method I believe in for long-term investors: Pare down your watchlist to the highest-quality businesses with the best brands and financial soundness, and focus on purchasing shares of those companies. It's preferable to buy them at bargain prices, but don't necessarily let the noise of market rallies and routs influence you too much. The most important factor to look for in the midst of the market's chaos is quality.

When stock prices drop, ask: Is the company's brand really broken?
Last August, I took advantage of temporary weakness in Starbucks' (SBUX -1.02%) share price to add a second position in the Prosocial Portfolio I'm managing for Fool.com. Needless to say, I don't regret the move, given Starbucks' solid earnings report last week, despite a challenging economic environment. Impressive revenue in the U.S. and Asian markets offset weakness in Europe, giving just one reason to believe this company has what it takes to get through many environments.

Even better (and looking far beyond last quarter or next), Starbucks has also been positioning itself to take advantage of trends other than the global thirst for coffee. Acquisitions such as the Evolution Fresh juice brand and Teavana will give it more breadth for the very long term.

Chipotle (CMG 6.33%) has recently skidded from investors' good graces. My first purchase of Chipotle shares for the Prosocial Portfolio was admittedly poorly timed, near its highs, but my second purchase for the portfolio took place after its subsequent plunge. (I added it to my personal portfolio, too.)

The bottom line: I don't believe that Chipotle's brand is in grave danger, nor do I buy that lower-cost Yum! Brands' Taco Bell can truly threaten Chipotle's future success. Responsible aspects, like Chipotle's emphasis on "Food with Integrity," give it major competitive advantage against lower-scale rivals. For the long haul, I'm not concerned about Chipotle even if it has recently lost some of its regard in many investors' and analysts' perceptions.

Although Chipotle trades at 30 times forward earnings, it's well off its highs, and also suffering from a great deal of analytic pessimism lately.

I've got no money on Apple (AAPL 0.52%), either personally or in the Prosocial Portfolio (and I probably won't until some labor and environmental issues are more deeply addressed by the company), but for investors who aren't concerned by such aspects, Apple looks like a ridiculous bargain right now.

Even if the Apple brand is losing some luster and some product momentum, it's currently trading at just nine times forward earnings and has a PEG ratio of 0.71. I'm sorry, folks, but that is dirt cheap, especially given its huge treasure trove of cash and the fact that the brand isn't broken.

Part of the chaos of the market is psychology and irrationality, and the fact that Apple has gone from being a stock that headlines seemed to suggest should be in every American portfolio to one that has plunged and is surrounded by serious fretting and angst means bargain-hunting investors should seriously consider getting in now.

Capitalizing from chaos
Look for the best companies through thick and thin, bull and bear markets, and particularly when their prices recede on temporary bearishness. However, while we should love cheap, we should be wary when cheap indicates the very real possibility of failure.

For example, forget Best Buy (BBY 1.09%). It may be trading at just seven times forward earnings, but its plunge is completely rational. This retailer's brand is tarnished and its perceived usefulness to consumers has been damaged, possibly irretrievably so.

Given recent adjustments to Best Buy's cash flow projections, one of the retailer's few positive attributes that could be key in saving the company from a nasty outcome is deteriorating. Investor, beware.

There are thousands of publicly traded companies to invest in, but research shows that most of them will turn out to be duds over the long term. Meanwhile, the market is incredibly inefficient, in the short term, anyway.

For individual investors who keep an eye out for the highest-quality companies to hold for the long term, the chaos factor can actually help build a strong portfolio even for the worst times.