The S&P 500 (SNPINDEX:^GSPC) has given investors a nice advance so far in 2017, climbing about 8% as of the end of June. However, some S&P 500 stocks have missed out on the gains and have lost considerable amounts of ground. Among the worst are Transocean (NYSE:RIG), Anadarko Petroleum (NYSE:APC), and Macy's (NYSE:M), with losses of about a third or more. Investors fear that if the same industry factors that have punished these stocks continue, then the shares could suffer even greater declines ahead.

RIG Total Return Price Chart

RIG Total Return Price. Data by YCharts.

Transocean struggles in a terrible energy environment

Transocean's decline comes as no surprise to anyone following the energy industry. Crude oil prices have once again resumed a downward trend in 2017, and that has hit offshore drilling specialists like Transocean especially hard. Because offshore projects tend to be more expensive, they're often the first projects that producers decide to suspend or delay during times of stress for the energy markets. Despite rebounding last year from their worst levels during 2015, crude oil prices haven't come close to recovering all of their declines.

Transocean has actually done a good job from a fundamental perspective in setting up its business to weather the storm in energy prices. Although many producers are still in no hurry to enter into new contracts for Transocean's rigs, the financial pressure on the entire offshore industry puts Transocean in a position in which it can consider poaching assets from weaker rivals at bargain prices. Transocean also has more than $10 billion in backlogged projects that it can work through during the dry spell, and strategic moves like selling off jack-up rigs to fund newer construction could end up being a smart move in order to preserve capital or use it for more productive purposes.

Transocean rig.

Image source: Transocean.

Anadarko deals with explosive issues

Anadarko Petroleum also has exposure to oil and natural gas prices because of its status as an exploration and production company. A poor price environment for energy has weighed on Anadarko stock, but the company also has some specific problems that it needs to resolve. In late April, a home just north of Denver exploded, and an Anadarko gas well ended being blamed for the explosion. Investigators found that a well connection hadn't been properly capped, allowing natural gas to move into the home and eventually cause the explosion. Colorado authorities ordered Anadarko to inspect all wells within 1,000 feet of existing structures, and another homeowner filed suit against the company.

Anadarko has a lot of potential to recover from its recent woes. It is one of the lowest-cost producers of energy from shale formations in the U.S., and Anadarko has made strategic moves to expand and take advantage of pressure on other companies in the sector. The stock is in good position to move higher if oil prices rebound, and even if they don't, Anadarko is stronger than many of its peers and could end up being a winner even after a prolonged downturn.

Macy's deals with retail woes

The retail sector has been under at least as much pressure as the energy sector, and department stores like Macy's have seen huge declines. Falling revenue, comparable-store sales, and profits have weighed on stock prices throughout the industry, and the result has been the need for store closures in order to try to find the right balance between shopper demand and available store supply. Macy's also hasn't yet been able to figure out a good response to the rise of online shopping, and its attempts to promote its own online sales haven't even kept up with those of its direct competitors, let alone online specialists.

There are still some reasons to be optimistic about Macy's future. The retailer has at least avoided suffering outright losses, and new leadership has the ability to take a fresh look at Macy's and try to figure out a better strategic path forward. Investors shouldn't expect better times to come quickly, but it's far too early to slam the door on Macy's prospects down the road entirely.

The S&P 500's gains have been impressive so far this year. If these stocks can finally rebound and start pulling their weight, then they could help the index produce even better returns for the full 2017 year and beyond.

Dan Caplinger has no position in any stocks mentioned. The Motley Fool has no position in any of the stocks mentioned. The Motley Fool has a disclosure policy.