Many software stocks got crushed over the past year amid rising interest rates, geopolitical conflicts, and other macroeconomic headwinds. Some of that sell-off was justified since the buying frenzy in growth stocks throughout 2020 and 2021 propelled the valuations of some software stocks to unsustainable levels. It was also inevitable that some companies would curb their spending on big software upgrades as they grappled with those near-term challenges.

Yet that sell-off also created promising buying opportunities for investors who can tune out the near-term noise. Let's take a look at two well-known software stocks that make the cut: Microsoft (MSFT -0.18%) and International Business Machines (IBM 0.04%).

A person uses a tablet computer next to a window.

Image source: Getty Images.

1. Microsoft

A decade ago, Microsoft was considered an aging tech giant that had run out of room to grow. Its Windows and Office cash cows were struggling with lengthy upgrade cycles, it faced disruptive competition from cloud-based services, and it was losing the mobile market to Apple and Alphabet's Google.

However, Satya Nadella rebooted Microsoft's business with a bold "mobile first, cloud first" mantra when he took the reins as its third CEO in 2014. Under Nadella, the tech giant transformed its desktop-based software into cloud-based services, abandoned its dying Windows Phone platform, and launched new iOS and Android apps to play nice with its rivals and stay relevant in the mobile market. It also expanded its Xbox gaming business with fresh hardware and big acquisitions and rolled out new Surface devices to spur the development of more innovative form factors across the PC market.

As a result, Microsoft's annual revenue grew at a compound annual growth rate (CAGR) of 11% between fiscal 2014 and fiscal 2022 (which ended this June) as its adjusted earnings per share (EPS) increased at a CAGR of 17%. Its stock has risen more than 420% over the past eight years and delivered a total return of nearly 500% after factoring in its reinvested dividends.

Past performance never guarantees future returns, but I believe Microsoft can generate robust growth for years to come as its cloud business continues to expand. Its stock still looks reasonably valued at 25 times forward earnings, it pays a forward yield of 1.1%, and it will likely remain an attractive evergreen investment regardless of the near-term macro challenges.

2. IBM

IBM delivered dismal returns for years before its cloud chief Arvind Krishna took the helm as its new CEO in early 2020. Under Krishna, IBM doubled down on the higher-growth hybrid cloud and artificial intelligence (AI) markets. It also divested its sluggish managed infrastructure services business as Kyndryl last November to accelerate that transformation.

It's too early to proclaim that strategy to be an unmitigated success, but IBM is consistently growing again -- even as it faces tough macroeconomic and currency headwinds across the world. Its revenue rose 8% year over year in the first nine months of 2022, while analysts anticipate 5% growth for the full year and 1% growth in 2023. They also expect its adjusted EPS to rise 15% this year and increase 6% in 2023. 

IBM doesn't have much exposure to macro-sensitive sectors like retailers, and it's been focusing on more "mission-critical" sectors that deploy its services to strengthen their automation and AI capabilities. Its hybrid cloud business, which crunches the data that flows between its private clouds and public cloud services, has also outpaced the growth of its older businesses with 15% year-over-year revenue growth over the past 12 months.

IBM isn't out of the woods yet, but this slimmed-down version seems a lot more promising than the original Big Blue -- which repeatedly struggled to offset the sluggish growth of its legacy businesses with its smaller and higher-growth segments. With a forward price-to-earnings ratio of 15 and a forward yield of 4.5%, IBM's downside potential seems limited -- even if the bear market drags on -- and it could be poised for a Microsoft-like comeback over the next few years.