The rumors of the demise of tech stocks have been greatly exaggerated. Many have fallen sharply from highs, yet others are making significant gains and setting up for future success. We can't control macroeconomic conditions like rising inflation and interest rates, geopolitical tensions, or other economic challenges. Still, investors are armed with resources that provide the best chances for profits.

When the macroeconomic conditions are murky, it's vital to invest in high-quality companies in growing industries with a clear vision for continuing success. These two companies make compelling cases.

Person touching a laptop with a diagram of research floating.

Image source: Getty Images.

1. Gartner

The global marketplace is more competitive than ever, and companies must adapt to compete. Whether digitizing the supply chain, developing growth strategies, modernizing sales operations, or optimizing costs, companies often need expert assistance and resources. Gartner (IT -0.71%) can step in and fill this need. The company provides companies with tools through research, consulting, and conferences. 

In one case study, Gartner was retained to assist a Media & Entertainment company with its new product launch logistics. This media company produced over $5 billion in annual revenue and needed solutions to a supply chain plagued by semiconductor shortages and port congestion due to COVID-19. Gartner provided research, data and analysis, and consultation that improved the media company's risk response and mitigation strategy, among other positive outcomes. 

Gartner also provides its famous Magic Quadrant research reports, highly touted in the tech field. Those who follow tech stocks have likely seen investor presentations that tout the company's position in a particular quadrant. In just one example, cybersecurity company Zscaler's March 2022 company presentation emphasizes its "11 consecutive years of Gartner MQ leadership." 

Gartner is a solid stock for several reasons. The company's revenue and operating profits are again growing on the increasing demand for its expertise. As the chart shows, sales dipped in 2020 primarily due to the pandemic, although operating profits were up. 

Gartner revenue and operating profits 2019-2021

Data source: Gartner. Chart by author.

Free cash flow over net income is produced, which the company uses to repurchase shares. Gartner repurchased $1.7 billion worth of its stock in 2021, which amounts to about 7% of the current market cap. This is extremely positive for shareholders.

The stock is down slightly this year and over 15% from its 52-week high. However, it is up more than 50% over the past year. The stock could outperform the market over the long term if management can continue to produce growth and profits.  

2. Mastercard

On the other end of the spectrum from the lesser-known and relatively small Gartner is payment processing giant Mastercard (MA -0.70%). Mastercard produced $18.9 billion in revenue in 2021, an increase of 23% over the $15.3 billion earned in 2020. 

Much has been made of the buy now, pay later (BNPL) threat to credit cards and payment processors Mastercard and Visa. However, this concern is wildly overblown. There are several downsides to BNPL that should be considered.

Credit card in front of laptop.

Image source: Getty Images.

First, the Consumer Financial Protection Bureau may be ready to clamp down on this largely unregulated industry, limiting choices. Next, transactions are often interest-free, but the late fees can exceed a typical credit card interest rate. Finally, studies show that many people use BNPL only after exhausting traditional credit cards; many later regret the purchases, and in one study, over half report being late on a payment. 

BNPL will likely be available for many purchases, but it won't be making much of a dent in Mastercard's business anytime soon. And business is good. Mastercard reported a gross dollar volume (purchase volume with cash volume including balance transfers) of $7.7 trillion globally in 2021, a 21% increase over 2020.

Mastercard's incredible operating margin of over 53% allows the company to produce a tremendous amount of cash, which it returns to shareholders through buybacks and a modest dividend. In 2021 the company repurchased $5.9 billion worth of its stock and paid $1.7 billion in dividends. The combination amounts to over 2% of the current market cap. 

An investor considering the options with $3,000 might be well served to split the funds between these two solid tech companies. The vastly different sectors provide terrific diversification. For those looking for just one option, Gartner may be the choice for the more adventurous growth investor due to its relatively small market cap. At the same time, Mastercard would appeal to those looking for a household name with a long track record of market outperformance.