CNBC's Jim Cramer said Thursday that retail earnings have revealed the middle part of the sector is "struggling."

"There's a market for high-end luxury goods and low-end mass market merchandise, but right now there's not much space in between," the "Mad Money" host said.

Diving into the sector's quarterly results, presented over the past weeks, Cramer noted that the discount, high-end and online businesses have been working for investors. The companies closely connected to malls are seeing the most pain, he added.

While market watchers worried that companies would be challenged by U.S. trade tensions with China — where many retailers source their products for lower costs — Dollar General and Dollar Tree were able to navigate the headwinds.

An Oppenheimer analyst on Thursday raised the firm's price target for Dollar General to $150 from $135, and management at Dollar Tree has said its acquisition of Family Dollar stores has started to pay off, Cramer said.

"Dollar General and Dollar Tree are so fantastic at sourcing that they haven't had to sacrifice their margins," he said. "That's why both stocks are handily outperforming the averages right now [with] Dollar Gen up nearly 26% and Dollar Tree up 20% for the year."

In the luxury segment, athletic apparel Lululemon and furniture seller RH — formerly Restoration Hardware — both gave shareholders earnings beats and guidance raises Wednesday, Cramer said.

Lululemon recorded 35% growth in its digital business, more than double the growth rate of the year prior, and announced it would open up to 15 stores in China.

"At a time when other retailers are retrenching, closing stores all over the place, Lulu can't put up enough stores. I like that," Cramer said.

Though RH at one point appeared to be losing steam, CEO Gary Friedman proved he should not be counted out, Cramer said. The home furnishing company delivered $1.85 earnings per share, topping estimates by 22 cents, and forecasted EPS between $8.76 and $9.27 for the year, compared to analyst estimates of $8.30.

"On the latest call, Gary said that he's moving 'certain production and new product development out of China, plus exploring new partnerships and expanding our own manufacturing facilities in the U.S.,'" Cramer said. "He doesn't want to be caught in the tariff crossfire."

Retail giants like Costco, Walmart and Target all boast low prices and are stepping up their delivery services. They have "the scale to dictate prices, even to the Chinese," Cramer said.

Meanwhile, Cramer said, the "mall stores are falling by the wayside."

Macy's is a company that investors don't seem to care about, and Nordstrom continues to miss, he said.

Kohl's, which the host said is usually reliable, seems to be losing a lot of shoppers, but Cramer has faith that CEO Michelle Gass "can turn things around."

Nonetheless, Amazon continues to put up great numbers, he said.