Source: Wikimedia Commons. 

After news that Rite Aid (RAD -8.33%), the world's third largest publicly traded drugstore chain, had smashed both revenue and earnings forecasts, shares of the company soared more than 8%. The news was also accompanied by a rosy outlook from the company's management team that suggests it may finally start growing again, raising the question of whether shareholders might enjoy the same growth CVS Caremark (CVS -0.74%) has experienced in recent years.  With all of this fantastic news, is it possible the company is still greatly undervalued or has all the "easy" money been already been made?

Rite Aid surprised analysts
For the quarter, Rite Aid reported revenue of $6.60 billion. This metric represents a 2% gain compared to the $6.46 billion management reported a year earlier and topped analyst estimates of $6.54 billion. According to its earnings release, the main driver behind the company's better-than-anticipated revenue was a rise in comparable-store sales.

Compared to the same time last year, Rite Aid's comparable-store sales jumped 2.1%, driven by a 3.5% improvement in the company's comparable pharmacy sales. This came about despite the negative impact of a higher level of generic drugs and was partially offset by a 0.7% decline in front-end sales.

 MetricActualForecastLast Year's Performance
Revenue $6.60 billion $6.54 billion $6.46 billion
Earnings $0.06 $0.04 $0.13

Source: Rite Aid and Yahoo! Finance.

In terms of profits, Rite Aid did better than Mr. Market hoped to see but fell short of what management reported in its fourth quarter of 2012. According to the company's earnings report, earnings per share came in at $0.06, 50% above the $0.04 analysts expected but well below the $0.13 the company earned last year.

In spite of higher sales, the business was harmed by a LIFO charge this year and benefited from a LIFO credit and a loss on the retirement of debt last year. Excluding these factors, earnings for the quarter actually rose 43%, from $0.07 last year to $0.10.

Source: hattiesburgmemory via Wikimedia Commons.

Is Rite Aid preparing to go CVS on us?
Over the past five years, the financial situation at Rite Aid has been anything but great, though it has been gradually improving. Since 2010, Rite Aid's revenue has declined 0.5% from $25.7 billion to $25.5 billion. This drop in sales came about because of the company shuttering 4% of its locations, all of which management deemed to be underperforming. This was, however, partly offset by an aggregate 0.8% improvement in comparable-store sales over that time frame.

While this picture may not look terrible, it pales in comparison to how CVS has done. Over a similar time frame, the company's revenue soared 29%, from $98.2 billion to $126.8 billion. Unlike Rite Aid, CVS' growth rate is partially attributable to an 8% increase in store count from 7,095 to 7,660. Its largest contributor, however, was an improvement in comparable-store sales. During the five-year time frame, CVS' comparable-store sales jumped an impressive 18%.

Company20142013201220112010
Rite Aid $25.5 $25.4 $26.1 $25.2 $25.7
CVS Caremark* $126.8 $123.1 $107.1 $95.8 $98.2

*CVS' data is for its five most recent completed years. Numbers in billions. Source: Rite Aid and CVS Caremark.

Looking at profits, the situation gets a little more interesting for Rite Aid. Over the past five years, the company has posted an aggregate net loss of $1.1 billion. This may make the company's situation look like the end of the road at first glance, but this may not be the case. Between 2010 and 2014, the business's net loss improved each year (except in 2011, when it worsened slightly) and has now been positive for two consecutive years.

Company20142013201220112010
Rite Aid $0.2 $0.1 ($0.4) ($0.6) ($0.5)
CVS Caremark* $4.6 $3.9 $3.5 $3.4 $3.7

*CVS' data is for its five most recent completed fiscal years. Numbers in billions. Source: Rite Aid and CVS Caremark.

In 2014, Rite Aid was able to post a profit of $220.9 million, up 87% from the $118.1 million the company reported a year earlier. This successful turnaround grew from management's focus on cutting out its underperforming stores and refocusing its efforts on improving margins as opposed to growing sales.

Moving forward, though, this trend might change. If management is accurate about how the business will perform throughout its 2015 fiscal year, then investors should expect the company to post revenue of $26 billion to $26.5 billion; this would be 2% to 4% higher than this year's numbers. Profits are also expected to rise, with the company anticipating earnings per share somewhere between $0.31 and $0.42, substantially greater than the $0.23 earned this year. If these predictions turn out to be true, then Rite Aid may have finally reached that stage in its turnaround where it can return to growth and start playing catch-up with CVS.

Foolish takeaway
Based on the data provided, it's clear that Rite Aid gave investors a heck of a present when it released its most recent earnings. This, combined with the company's strong outlook, suggests that its future prospects might be brighter than ever. While this is good for shareholders and may lead to a better share price down the road, the Foolish investor should be cognizant of the costs involved.

Yes, the drugstore chain may create a lot of value moving forward, but at 16.5 to 22 times forecast earnings, its more expensive than CVS' 16.3 times forward estimate. For this reason, as well as the higher chance that it could fall back into negative territory easier than CVS might, investors should remain only cautiously optimistic.