It's been a difficult six months for General Electric (GE -3.19%) and Stanley Black & Decker (SWK). Both stocks are in negative territory over the period and have notably underperformed the S&P 500 index, which is up more than 11%. That said, the dip in both stocks is creating a good buying opportunity; here's why.

General Electric

There are probably two reasons for the stock's underperformance in recent months. The first is the negative impact on air travel from the resurgence of COVID-19 cases and the emergence of new variants. This hurts GE because GE Aviation is the company's most significant earnings and cash flow generator. Two-thirds of commercial airplane flights are on GE or GE joint venture engines, and the revenue from servicing engines in use is the key to the segment's profitability. So any slowdown in flight departures due to travel restrictions is terrible news for GE.

An airplane taking off.

Image source: Getty Images.

The second is the underwhelming reaction to the plan to break up the company into three different companies. The plan announced in early November involves spinning off the healthcare business in early 2023, and then the power, renewable energy, and GE Digital businesses into one company and spinning it off in early 2024. The remaining GE will be an aviation-focused company.

Both reactions look overblown. While there's no telling when the pandemic will become endemic, the fact is that the vaccines work, and therapies are reducing the severity of cases. Meanwhile, people still want to travel. Everything points to an ongoing recovery in commercial aerospace continuing, even if its pace is uncertain.

Turning to the breakup plans, a sum-of-the-parts analysis for GE shows its constituent parts are worth more when valued (against peers) separately than as part of GE. At the same time, there's ample evidence to suggest that the businesses could be better run individually.

CEO Larry Culp aims for more than $7 billion in free cash flow (FCF) in 2023 , compared to GE's current market cap of $106.5 billion. That makes the stock look like a good value in itself, and with the breakup offering upside potential, GE seems a good buy right now.

Stanley Black & Decker

The tools and hardware stock started the year with expected inflation and cost headwinds of $75 million in 2021, but that estimate is now $690 million as of its third-quarter earnings. As a result, it's created significant margin pressure for the company. That's a big part of the reason why the stock has underperformed in the last six months.

A DIY worker with a wood table and tools.

Image source: Getty Images.

But here's the thing, or rather a few things. First, management is taking pricing action and sees improving margins through 2022 as cost pressures subside and pricing kicks in.

Second, the company's revenue is set to jump from $17.2 billion in 2021 to $20.2 billion in 2022 as its MTD and Excel (lawn and garden equipment) acquisitions are incorporated into its financial results. Management sees a significant margin expansion opportunity in these businesses as they integrate into Stanley's complementary businesses. Third, the company has invested heavily in new products, which should boost growth in 2022 and beyond.

Finally, the company recently agreed to sell most of its security assets to Securitas AB for $3.2 billion in cash. The proceeds will go toward a planned $4 billion share repurchase program in 2022. Moreover, selling the security business will allow management to focus on its core tools and storage business.

Putting it all together, it's not hard to see that the narrative around the stock is likely to change through 2022. Hopefully, at the end of next year, investors will be looking at a stock with a rising margin trend. In addition, the share repurchases will support the stock price and boost shareholder value. Meanwhile, the market should be focusing on the medium-term margin expansion opportunity at MTD as Stanley expands in the lawn and garden equipment category.

If the company hits Wall Street analyst estimates for nearly $2 billion in FCF in 2022, the stock will trade at just 16 times its 2022 FCF. That's far too cheap for a stock that should end 2022 firing on all cylinders with mid-single-digit revenue growth and margin expansion ahead of it.