Oh dear! You were thinking of buying shares of a stock that has skyrocketed. What are you going to do?

If you thought stocks never had gains anymore, take a closer look. Intuitive Surgical (NASDAQ:ISRG) is up more than 50% in the past month! Charles Schwab (NASDAQ:SCHW) and Yum! Brands (NYSE:YUM) are both higher by around 20% in the same period, while Western Union (NYSE:WU) has seen its price jump almost 40%. Are you simply too late?

Not necessarily. It's not all about the stock's current price -- though of course buying at a lower price is usually better. If you think that Carrier Pigeon Communications (ticker: SQUAWK) is worth $60 per share, it can still be a bargain at $45, even if you missed out on buying it at $30.

Do some digging
You can get a sense of a stock's relative value by comparing it to its peers. Yum! Brands, for example, has recently sported a price-to-earnings (P/E) ratio of around 18. Given that McDonald's (NYSE:MCD) and Burger King (NYSE:BKC) have had P/Es around 14, that makes Yum! look like less of a bargain. Still, though, you'd want to dig deeper.

You might compare profit margins, for example, to see which is wringing out the most bang from each buck, as well as their dividend yields:

Company

Net Profit Margin

Dividend Yield

Yum! Brands

8.4%

2.2%

McDonald's

18.9%

3.7%

Burger King

7.3%

1.3%

Data: Yahoo! Finance.

Growth rates also give you a sense of where the companies have been lately:

Company

5-Year Revenue Growth

5-Year EPS Growth

Yum! Brands

5.7%

13.5%

McDonald's

6.4%

20.1%

Burger King

11%

N/A

Data: Motley Fool CAPS.

The numbers above reflect the quality of the company. To get a sense of how attractive its price is, you might compare its P/E with its average range in recent years:

Company

Recent P/E

High/Low P/E in Last 5 Years

Yum! Brands

18

11-24

McDonald's

14

11-32

Burger King

14

N/A

Data: Motley Fool CAPS.

Looking just at this data, you might conclude that McDonald's is priced most attractively right now. But remember -- this is just a start. The more you dig and the more you learn, the better handle you'll have on the company, and the greater your confidence will be regarding why you want to buy or not buy it.