Last month I wrote about how investors can take a look at operating margins to get some answers about who is an industry leader. Just by checking annual percentages, you can see who the dominant players are, who the 98-pound weaklings are, and who the up-and-comer is to challenge the leader. Using's 10-year financials, which calculate margins for you, it's a quick, painless process.

In addition to deciding what company to buy, I also use margin analysis to help me determine when to sell. Yet instead of the annual overview of margins, I try to get a more granular look by examining the quarterly numbers.

As you'll recall, operating margin is calculated by dividing operating income by sales. It measures a company's pre-tax profitability from its primary operations, and slippages and declines can warn of future problems.

We could tackle the equations by pulling out our calculators and wading through the quarterly financial statements, but for this initial test of our game of Buy-Sell-Hold, we'll let do the work for us. It provides five quarters of financial data and conveniently calculates operating margins for you. Enter your company's name or ticker, choose Financials from the resulting Fact Sheet, then select Quarterly Financials, and the first page that pops up will be the income statement. Scroll down a couple of lines until you find the operating margin line item.

Quarterly margins are bound to fluctuate, and small changes should not be a concern. What we're looking for are larger trends, percentage changes of 25% or more over five quarters, to give us our signals to sell. For example, a drop in operating margins from 17% to 13% would be just as significant as a drop from 43% to 34%, as both represent 25% declines.

Let's take a look at PeopleSoft (NASDAQ:PSFT), the enterprise software company that has been locked in a melodrama with Oracle's (NASDAQ:ORCL) seemingly megalomaniacal CEO Larry Ellison (certainly comparing yourself with Genghis Khan would rank you up there on the megalomaniacal scale). Whether it's the cost of defending itself against the hostile takeover bid or some other reason, PeopleSoft was churning out some disappointing numbers this year. First-quarter net earnings had dropped 37%, and EPS was off 41%. The stock itself dropped about 18%, falling from around $22 a share to $18.

Yet had you been watching PeopleSoft's quarterly operating margins, you would have detected warning signs six months ahead of everyone else! Plenty of time to assess the numbers and get out. Look at the numbers:

Q204 Q104 Q403 Q303 Q203
Operating Margin 2.8% 6.4% 5.0% 2.2% 12.9%

From June to September of last year, margins dropped a whopping 83%. While I noted that quarterly fluctuations are possible, a drop of that magnitude ought to make you sit up and take notice. Yet even as margins seemingly improved over the next two quarters, we still had a 50% fall-off from June. When this year's second-quarter earnings report came out, margins once again fell off the table, dropping 56% from the prior quarter and still off 78% from last year. By this point, though, PeopleSoft was trading around $16 a share, down some 25% from the time of the third-quarter announcement last year.

The company has gained some traction lately as it fired its CEO, batted its eyes longingly at Oracle, and tried to woo its onetime suitor back. Yet Ellison is nothing if not shrewd and may be trying to talk down the price once again. Investors, though, could have used margin analysis to avoid the unfolding melodrama and instead watch with bemusement from the sidelines, locking in their profits well before others had realized that there was trouble brewing.

Fool contributor Rich Duprey is often bemused by the golden color of his Coors Light. He does not own any of the stocks mentioned in this article.