The interior of a Midwest Whole Foods Market location. Photo: Whole Foods. .

Shareholders of Whole Foods (WFM) have had to swallow their fair share of rough news over the past year. Shares of the company fell over 40% in that time on fears that a combination of competition and margin compression would leave the company far less profitable than it has been in the past.

I didn't buy into that narrative, and put a lot of my own money behind the company during the dip. But now that Whole Foods seems to be back in Wall Street's favor -- rising almost 30% in the last month alone -- does that make the stock a buy, or have investors missed their chance? Read below to find out.

First, a look at the hard numbers
There are many different ways to value a company and its stock. The most popular is the price-to-earnings ratio. In Whole Foods' case, it is difficult to draw comparisons to the competition. The company is still much smaller than larger grocers such as Wal-Mart (WMT 0.57%), Kroger (KR -0.43%), and Safeway (NYSE: SWY), yet its much more established than natural/organic upstarts like Natural Grocers (NGVC 2.18%), Sprouts Farmers Market (SFM 0.47%), and The Fresh Market (TFM).

Knowing that, here's how those grocers all stack up on a P/E basis.

As you can see, compared to the S&P 500, Whole Foods is trading at a pretty significant premium. But that's to be expected, as the company is growing both revenue and earnings faster than the average company.

Compared to traditional grocers, Whole Foods looks expensive (except for Safeway, but that's because the grocer is being bought out by Cerberus Capital for a hefty premium). Again, however, that's to be expected. Wal-Mart has 4,344 locations in the United States. and Kroger has 2,642 locations through various subsidiaries. Whole Foods, on the other hand, just crossed the 400-store threshold -- so there's still a lot of room for the company to grow.

Compared to other traditional/organic grocers, Whole Foods looks cheap to fairly priced. Again, this makes sense, as the other players have fewer locations and have been showing -- especially in the case of Sprouts -- impressive same-store sales that trump what Whole Foods has produced.

Maddeningly, the whole exercise shows that Whole Foods is priced just about where it should be. For a little better perspective on the grocer, it might also be worth comparing the company's P/E today to past numbers.

The company in this context looks cheap compared to past valuations. It's worth noting, however, that same-store sales have slowed from the 9%-10% range a few years ago, to the 3-5% range today.

But that still doesn't answer the headline question.

Is Whole Foods stock a "buy now" stock?
Here is where the important qualifier comes in: how long are you willing to hold the stock? Over the short-to-medium term -- say, months to three years -- it might not be the best stock if you're looking to make a quick buck.

Whole Foods has ramped up its store build out, and that costs a lot of money. It is also lowering the prices on many of its organic fruits and vegetables in order to keep pace with the competition. Over the short run, those moves could show up on the company's financial statements in ways that don't appear very shareholder-friendly.

Focusing on lowering prices -- and shedding the pejorative "Whole Paycheck" moniker -- will take time. Word of mouth will ultimately be the greatest tool for letting consumers know that Whole Foods isn't that expensive when comparing (pardon the pun) organic apples-to-apples.

But if you are looking to invest for the long run -- think decades -- in a visionary management team with an excellent track record, buying today might be worth considering. Whole Foods has made it clear that it expects to one day have 1,200 locations nationwide. That means at least tripling today's current count.

And no other store benefits more from the organic movement, and from the education happening inside schools and community centers every day about the benefits of healthy eating, than Whole Foods. The company is the head-and-shoulders leader when it comes to transparency, and I expect it to prosper over the long term.

I'm not buying shares today, but that's because the company already comprises over 5% of my real-life holdings. That said, I certainly have no intentions of selling anytime soon. And I look forward to the day when the store build outs slow, and the dividend starts creeping up.