Few investors have high hopes for department stores right now. Companies across the sector have been losing business to off-price retailers as well as Amazon.com. As a result, department store stocks have plunged in the past couple of years.

With this backdrop, Macy's (M -1.52%) and Kohl's (KSS -2.01%) released their third-quarter earnings reports on Thursday morning. Both companies posted mixed results. Macy's reported another disappointing sales performance, but it still managed to deliver a modest earnings beat. Meanwhile, Kohl's posted surprisingly strong sales but missed earnings estimates.

Macy's gives investors some hope

At the company's investor day back in June, Macy's management indicated that sales would probably be stronger during the second half of fiscal 2017 than in the first half of the year. That did not play out in the third quarter, though. Total sales declined 6.1% year over year, while comp sales fell by 3.6%. This was exactly in line with Macy's first-half performance.

A rendering of the exterior of a Macy's store

Macy's reported another big sales drop for the third quarter. Image source: Macy's.

While this sales performance was worse than the 2.8% decline that analysts were expecting, Macy's faced a variety of headwinds in Q3. Sales to international tourists fell yet again, major hurricanes disrupted operations in several markets, and unseasonably warm weather depressed sales of cold-weather items for most of the quarter.

On the bright side, Macy's gross margin improved modestly year over year (from 39.8% to 39.9%) due to tight inventory control. This suggests that the panic about Macy's gross margin trends earlier this year was a big overreaction. Operating expenses also continued to decline.

The net result was that adjusted earnings per share (EPS) reached $0.23 last quarter, up from $0.17 a year earlier. On average, analysts had been expecting EPS of $0.19.

To be fair, Macy's did benefit from $65 million of asset sale gains last quarter. Without those gains from selling real estate, EPS would have been much lower. However, asset sales have been a constant feature at Macy's recently, and will be for the foreseeable future.

Kohl's: the Q3 earnings report isn't as bad as it seems

Kohl's surprised investors on Thursday by reporting that comp sales increased 0.1% last quarter. That marked a solid improvement from the 1.5% decline it posted for the first half of fiscal 2017.

The exterior of a Kohl's store, with clouds overhead

Sales trends improved at Kohl's last quarter. Image source: Kohl's.

According to management, Kohl's benefited from strong sales during the back-to-school period and another uptick in sales in the second half of October. This offset the negative impact of hurricane-related disruptions and unseasonably warm weather during the middle of the quarter.

Unfortunately, Kohl's gross margin ticked down to 36.8% in the quarter, compared to 37.1% in the prior-year period. Combined with a modest rise in operating expenses, this caused adjusted EPS to sink to $0.70, compared to $0.80 a year earlier. Analysts were expecting EPS of $0.72, on average.

Despite the earnings miss, Kohl's raised its full-year EPS guidance. It now expects adjusted EPS of $3.60 to $3.80, compared to $3.50-$3.80 previously. Additionally, it expects to book a favorable tax settlement this quarter, adding another $0.12 to EPS.

Both of these stocks are undervalued

Macy's stock skyrocketed after the earnings report, rising 10% as of 1 p.m. EST Thursday. Still, it trades for less than $20, compared to a 52-week high of around $45 reached last November. By contrast, Kohl's stock fell as much as 7% before recovering most of its losses. There's plenty of room for Macy's stock to keep rising -- and for Kohl's shares to get back on track.

Crucially, executives at both companies confirmed that sales trends have been stronger to start the fourth quarter, as weather patterns have turned more favorable. Furthermore, both stocks are dirt cheap.

Kohl's stock trades for about 11 times its projected 2017 EPS. However, free cash flow is likely to exceed EPS by a wide margin once again in 2017 and will probably surpass $1 billion for a second consecutive year. Thus, Kohl's stock trades for less than seven times free cash flow.

Macy's stock is even cheaper. After skyrocketing on Thursday, it still traded for less than seven times the company's adjusted EPS forecast. If real estate gains were excluded from earnings, Macy's would trade for just eight times EPS. Considering that the company is likely to reap a multibillion-dollar windfall from real estate sales over the next five years, that's a recipe for big gains for patient shareholders.