The last thing any investor wants to do is to buy stocks when they're expensive. But when two of the most experienced academicians in the field of market analysis can only butt heads repeatedly over what seems like the simplest way possible to evaluate stocks, you know you've got a mind-bender on your hands. But it's a mind-bender worth solving -- because the answer could make a huge difference in your long-term investing results going forward.

The great debate
At the heart of the controversy over stock valuations is how to evaluate earnings for purposes of calculating a price-to-earnings ratio. In one corner is Wharton professor and market historian Jeremy Siegel, who spoke at TD AMERITRADE Institutional's annual conference yesterday. Siegel believes that stocks are undervalued, looking at the current P/E ratio for the S&P 500 and concluding that the market should be about 20% higher assuming a normal rate of inflation going forward. If low inflation continues, Siegel sees a much more bullish target above 2,000 for the S&P 500 -- a better than 50% gain from current levels.

In his talk, Siegel claims to have found a flaw in the argument that Yale professor Robert Shiller uses as Siegel's primary opponent against his use of the P/E ratio to support his claims. Shiller argues that in order to smooth the impact of a single year's fluctuations in earnings, you should use what he calls a cyclically adjusted P/E, or CAPE ratio, to measure valuation. Rather than simply looking at earnings over the past 12 months, the CAPE ratio goes back 10 years to use a moving average of inflation-adjusted earnings. And right now, the CAPE ratio for the S&P 500 stands at about 21 -- well over what you'd typically see if you expect a bull market of the magnitude Siegel sees.

Why Siegel thinks he's right
In his talk yesterday, Siegel said that he had found a flaw in Shiller's analysis. Looking at 2008, he figured that Wall Street banks Bank of America (NYSE: BAC) and Citigroup (NYSE: C), along with insurance giant AIG (NYSE: AIG), lost a total of $450 billion in the crisis-ridden year. The impact of the declines in financial company profits hit the S&P 500's profits by a whopping 80%.

But when Siegel checked those figures against an independent measure of corporate profits, he found a huge discrepancy. The alternative source saw only a 25% drop -- obviously huge, but nowhere near as severe as what S&P earnings figures would suggest.

As a result, although Siegel acknowledges the value of a smoothing method for P/E calculations, he believes that the financial crisis prevents the CAPE model from working correctly.

So who's right?
This isn't the first time that Siegel and Shiller have argued about valuation, and it won't be the last. Once you start going down the road of what's cyclically appropriate, it opens a whole new can of worms. For instance, ExxonMobil (NYSE: XOM) and Chesapeake Energy (NYSE: CHK) both saw huge profit gains when energy prices spiked in 2006 to mid-2008, only to fall back substantially in 2009 when oil and gas tumbled. Some argued that near-$150 oil was driven by speculation, so does CAPE make incorrect conclusions for energy stocks as well?

Reasonable people may disagree forever. But there is a middle position that has some appeal: make a smaller but still significant adjustment to earnings to reflect the 2008 anomaly.

For instance, AIG has earned almost $9.2 billion in the past year. If you accept Siegel's argument that the company's $99 billion loss in 2008 is too extreme to reflect normal cyclical activity, it still makes sense to discount earnings somewhat if they're arguably inflated by the poor showing four years ago. The same goes for Citigroup and its $11.3 billion profit in 2011 after a $27.7 billion loss in 2008. B of A, on the other hand, did its own smoothing of earnings and moreover still hasn't seen profits recover.

The real answer
If you make a smaller adjustment, you'll end up somewhere in between Siegel and Shiller. That may lead you to conclude that stocks are in a Goldilocks just-right place. But as I see it, the real takeaway is this: rather than looking at the market as a whole in determining value, accept that a market is made up of stocks, and focus on finding the best values you can. That way, you don't have to worry about whether the entire stock market is overvalued or not.

Great stocks don't always come cheap, but often, they're worth paying fair value for. Discover the names of three of them by accepting my invitation to read the Motley Fool's latest special report, which focus on stocks that will help you retire rich. The report is absolutely free, but it won't be around forever, so click here and read it today.