A theoretical study is performed on the relation between magnetic properties and lattice structures, that is, lattice constants and local atom displacement, for rhombhedral (rh-) Y2Fe17 compounds. We use real-space full-orbital tight-binding formalism to calculate electronic states. Magnetic anisotropy (MA) is calculated with high numerical accuracy by adopting a second-order perturbation for spin-orbit interaction. It is shown that the local magnetic moments of Fe atoms on 9d and 18h sites increase with increasing lattice volume. The result is attributed to the high atomic area density of these sites on the hexagonal planes. Those of Fe atoms on the other sites are found to be nearly independent of the volume. We calculate local MA energy of Fe atoms on each nonequivalent site and find that the magnitude of the local MA is strongly affected by the local atom displacement. As a result, the MA of Y2Fe17 is shown to be sensitive to volume.