It's virtually impossible to perfectly time the purchase of a stock for maximum return, but you can enhance your odds of long-term success if you buy when a company looks historically cheap. That's the case today for both Clorox (CLX 0.24%) and Kellogg (K 1.49%), two iconic consumer-goods companies that have incredible histories and reputations for regularly increasing their dividends.

If you have $1,000 available that you'd like to put to work today, you'll want to dig into these two names.

A rubber stamp with dividends on it.

Image source: Getty Images.

1. Clorox: OK, that hurt

After Clorox reported fiscal second-quarter 2022 results in early February, its stock fell sharply. There was a very good reason for that, given that its gross margin fell by 12.4 percentage points year over year. That's a huge decline and one that should worry investors. But what really happened? 

In 2020 after the start of the pandemic, demand for Clorox's cleaning products took off, and the company couldn't keep up. It outsourced some production, which simply costs more than producing products in-house. As 2021 got underway, inflation started to spike, further increasing the company's costs.

The normal course of action here is to raise prices, but demand for cleaning products has been falling, so price hikes weren't really an option right away and wouldn't have offset the demand drop anyway. And thus, Clorox's margins got clobbered, the stock fell sharply, and now the dividend yield, at around 3.5%, is near historical highs. 

There's no easy fix for the margin issue. It's going to take time to cut costs and pass rising prices on to consumers. But Clorox has some levers to pull, including terminating outsourcing production contracts. And if you dig into the numbers a little, the news isn't actually as bad as it seems, with the health and wellness division (about 38% of sales and where its cleaning products report) the main negative. Sales were flat or higher throughout the rest of the company's divisions.

It could take a couple of years to get margins back to where they were, but Clorox has a long history of success and is a Dividend Aristocrat with 45 years of annual dividend hikes under its belt. If you are a long-term investor willing to ride out a rough patch, this consumer staples company is worth researching now.

2. Kellogg: One lingering problem

Although inflation is a headwind for Kellogg, just like all of its peers, the issue that seems most on investors' minds is cereal. That makes sense, given Kellogg's long history as a leader in the space. However, it has not been doing well of late in the cereal aisle, with market-share losses and company-specific problems (a plant fire and an employee strike) that have made things even worse. Management believes it will take until the back half of 2022 before its cereal division will be back to normal operations. 

And while it's working on getting this business straightened out, it will be trying to push through inflation-related price increases throughout the rest of its business.

But that's actually an important thing to get your head around: the rest of Kellogg's business. While cereal is what the company is known for, it makes up only 25% of sales, split between foreign markets (10% of sales) and domestic (15%). It is important, to be sure, but the company just needs its cereal products to be stable; it isn't counting on them for growth.

Growth is going to come from the food maker's repositioning efforts, which were completed just as the pandemic hit. It now has a large snack business (40% of sales), a material presence in emerging markets (25%), and frozen foods (10%) to handle the need for growth.

In fact, despite the headwinds from cereal, Kellogg managed compound annual sales growth on an organic basis of roughly 5% over the 2020 and 2021 periods. Looking at the two-year period is important because the pandemic's demand spike obscures the success the company has had with its repositioning efforts. 

Simply put, other than cereal, it looks like Kellogg is doing fairly well. But investors are focused on the negatives, depressing the stock and pushing the yield up to a historically high 3.8%. For patient long-term investors, this could be a good opportunity to buy this Dividend Achiever with 18 years of annual hikes under its belt. 

Valuation matters

Investing is always about balancing the trade-off between risk and reward. There are no easy answers to make this a simple process. But if you focus on buying historically well-run companies when they appear historically cheap, you'll give yourself an edge.

Using dividend yield as a valuation tool, both Clorox and Kellogg appear to be on sale right now. If you can handle sitting tight while they muddle through some headwinds, this pair of longtime dividend payers could be a great place to park $1,000 today. And you'll get paid well while you wait for better days.