Yes, the X-7 rear derailleur is designed to work in both 8-speed and 9-speed setups. In this case, it sounds like you need to match your shifter with the cassette already on your bike (unless you are planning on swapping the cassette as well). As Retro Grouch noted, the shifters themselves come in either 8-speed or 9-speed configurations, and they are not interchangeable.