What matters most when buying a stock is the quality of the company behind it, Jim Cramer reminded his Mad Money viewers Tuesday. When the markets start rotating out of high quality stocks, that's your signal to begin buying.

Case in point: drugmaker Merck (MRK) , which had been riding high on the success of its newest cancer drug, Keytruda. Shares had risen from $73 in April to over $87 just a few weeks ago. But as the market panicked about the possibility of an economic downturn, shares of Merck have lost $5 in just two days. Cramer said Merck is a buy, given the company's strong balance sheet and bountiful dividend yield that pays more than Treasuries.

Cramer was also bullish on Estee Lauder (EL) and Mastercard (MA) , two more former market darlings that have suddenly plunged. Some stocks, like Citigroup (C) , deserve to be lower, Cramer said, but high quality companies like Estee Lauder and Mastercard simply do not.

If given the choice between Macy's (M) and Costco (COST) , it should be easy to pick the high quality name. One retailer is likely to cut its dividend, while the other derives its revenue from lucrative membership fees and continues to have strong same-store sales.

Don't be emotional when the markets are falling, Cramer concluded. Stick with the best-of-breed companies and you'll always be buying your stocks on the cheap.

Cramer and the AAP team are looking at everything from tech stocks, to healthcare and Apple's (AAPL) big event. Find out what they're telling their investment club members and get in on the conversation with a free trial subscription to Action Alerts Plus.

Off the Charts: Bonds, Gold

In the "Off The Charts" segment, Cramer checked in with colleague Carley Garner to see if the charts of U.S. Treasury bonds and gold can shed some light on whether these investments are still safe places for your money.

Garner first looked at a monthly chart of the 20+ Year Treasury Bond ETF (TLT) , noting the peak at $149.20 which coincided with a strong relative strength indicator. She noted the past five times the RSI peaked, it forecast dramatic selloffs. This time could be different, Cramer said, but according to Garner, the odds are against you.

As for gold, Garner consulted a gold futures COT Report, noting that large speculators currently hold 300,000 gold contracts. This is precisely the level when gold typically reverses course. Cramer said when everyone is bullish, there's simply no one left to buy.

That's why Cramer agreed with Garner that after months of fleeing to these safe-haven investments, it may be time to start scaling back.

Executive Decision: VMware

For his "Executive Decision" segment, Cramer spoke with Sanjay Poonen, COO of VMware (VMW) , a stock that rallied 3.9% today after the company announced two acquisitions.

Poonen explained that technology transformations only come along once every 10 to 20 years, so when you see one, you need to pounce on it. The current transformation in cloud computing is what's called containers -- applications that can be easily moved from place to place -- and today's acquisition of Pivotal helps VMware own this space.

The second acquisition was Carbon Black, a cybersecurity platform that VMware plans to add to their offerings.

Combined, Poonen said these two acquisitions will add $1 billion in revenue over the next two years. As a combined entity, they will accelerate the go-to-market strategy and build the next generation of cloud-computing applications. 

AT&T and Elliott Management 

Are shares of AT&T (T) worth buying now that activist investor Elliott Management has taken a $3.2 billion stake in the telecommunications giant? Cramer dove into Elliott's proposal to find out.

The lackluster performance of AT&T is indeed astounding, with shares up just 10% over the past five years. Compared to the S&P 500, and its chief rival Verizon (VZ) , that's just plain awful. The problems began after AT&T's failed attempt to acquire T-Mobile (TMUS) , which resulted in a $4 billion breakup fee that gave T-Mobile the firepower it needed to become a viable competitor. Then AT&T spent $67 billion to buy DirecTV and $109 billion to buy Time Warner, giving it substantial debt and little growth to show for it.

That's why Elliott's plan makes a lot of sense, Cramer said, as they're calling for selling non-core assets, paying down debt and improving operating efficiencies. Elliott also proposes pausing merger activity, protecting its dividend and buying back stock to boost share prices.

Cramer said he's a buyer of AT&T, especially with shares trading at less than 10 times earnings. He hoped AT&T opts to work with Elliott to reinvigorate this household name that has clearly lost its way.  

What Do Millennials Want?

In his "No-Huddle Offense" segment, Cramer said, like it or not, the millennials will inherit the Earth one day, and that has great consequences for today's companies.

The millennials are saddled with high student debts and low salaries, which makes them slow to start families but quick to snap up a good bargain. Nowhere was that fact more apparent than at Monday's visit to Dollar Tree (DLTR) , Cramer explained. Fewer millennials own cars, he said, so they shop closer to home. They love to price compare and they most certainly read the labels and prefer private label items. All of these trends bode well for the continued rise of Dollar Tree and rival Dollar General (DG) .

Beyond the dollar stores, Cramer said the millennials still like food delivery and video games, but so far, the dollar stores have been the biggest winners. 

On Real Money, Cramer says millennials are the future, and consumer-facing companies need to know that. Get more of his insights with a free trial subscription to Real Money.

Lightning Round

In the Lightning Round, Cramer was bullish on Planet Fitness (PLNT) , PaySign (PAYS) , Oneok (OKE) , Motorola Solutions (MSI) , Anthem (ANTM) , Kennedy-Wilson (KW) and HEICO (HEI) .

Cramer was bearish on Schlumberger (SLB) . 

Introducing TheStreet Courses: Financial titans Jim Cramer and Robert Powell are bringing their market savvy and investing strategies to you. Learn how to create tax-efficient income, avoid top mistakes, reduce risk and more. With our courses, you will have the tools and knowledge needed to achieve your financial goals. Learn more about TheStreet Courses on investing and personal finance here.

Search Jim Cramer's "Mad Money" trading recommendations using our exclusive "Mad Money" Stock Screener.

To watch replays of Cramer's video segments, visit the Mad Money page on CNBC.

To sign up for Jim Cramer's free Booyah! newsletter with all of his latest articles and videos please click here.

At the time of publication, Cramer's Action Alerts PLUS had a position in AAPL, MA, C, SLB.