While the average distance (semi-major axis) of Halley's Comet from the Sun is 17.8 AU (astronomical units), this distance can vary significantly during its orbit. The comet's path is highly elliptical, taking it as close as 0.59 AU from the Sun (closer than the Earth's orbit) and as far out as 35.1 AU (beyond the orbit of Neptune).
The orbital period is determined by the comet's entire elliptical path, not just its average distance.