Wall Street wasn't thrilled with the latest earnings update out of McCormick (MKC 0.23%). The spice and flavorings giant reported a slight drop in sales volumes again as shoppers continue to scale back their purchases in an era of rising prices. The stock fell in response to the Q2 announcement and now trails the market's 15% rally year to date by a wide margin.

There's plenty to like about McCormick's performance in this difficult selling environment, though, including rising market share and improving profit margin. Let's take a closer look at that report and the biggest positive takeaway for shareholders.

McCormick saw solid growth in Q2

McCormick is back to expanding sales at a double-digit rate, which is a welcome improvement compared to the prior quarter's 5% uptick. But this growth is coming entirely from higher prices. Volume fell 1% in the quarter as prices increased 11%.

The good news is that McCormick was able to pass along those higher prices without sacrificing much in the way of sales growth, and in fact, the increases accelerated revenue gains. That strategy has worked well for industry giants like PepsiCo (PEP -0.62%) and is paving the way for McCormick to boost its business in 2023 and beyond. "We delivered strong second-quarter results," CEO Lawrence Kurzius said in a press release, "reflecting sustained demand across our business."

The green flag for McCormick

The clearer green flag is in the profit arena, though. Gross profit margin expanded by 3 full percentage points this quarter thanks to the combination of higher prices and McCormick's aggressive cost-cutting. These gains flowed right down to the bottom line, too. Operating income jumped to $222 million in Q2, up from $157 million a year ago. After adjusting for one-time charges and currency exchange rate shifts, operating profit soared 36% year over year.

MKC Operating Margin (TTM) Chart

MKC Operating Margin (TTM) data by YCharts

This extra cash will likely benefit shareholders in many ways. For one, McCormick now sees profits rising at a double-digit rate in 2023. The higher cash flow is giving management plenty of resources it can direct toward growth initiatives, too, along with that rising dividend.

The right price

McCormick shares look attractive today given those positive factors. You can buy the stock for around 3.6 times annual sales, down from a pandemic high of nearly 5. Sure, the company isn't growing as quickly, and demand trends over the next few quarters might look soft.

But McCormick is still winning market share in the huge global industry niches of sauces, condiments, and flavorings. Its lower cost profile is laying the groundwork for better annual earnings this year and even faster profit growth once the next cyclical upturn starts.

Risk-averse investors might want to wait for more signs of that gathering rebound before buying the stock. But greater returns will come to investors who buy shares when Wall Street's sentiment is relatively low -- like it is right now. McCormick is highly likely to be setting sales and profit records in a few years. By then, you'll be happy you added this dividend stock to your portfolio.