Gravity on Earth uses two concepts, one is the radius (R) of earth and the other is the distance (h) from the surface of the Earth.
Really, approximating the Earth to be spherical and uniform, it is just one distance, the distance from the center of the Earth that matters.
$F = G \frac {M_{Earth} m}{r^2}$
where $r$ is the distance from the center of the Earth to the other mass.
What then would be the equation that I would use to calculate the pull from the Andromeda galaxy?
You could get a reasonable approximation from the same equation using the masses of the two galaxies, the Milky Way being about $9 X 10^{11}$ solar masses and Andromeda being about $1.4 X 10^{12}$ solar masses according to The masses of the Milky Way and Andromeda galaxies, and the center to center distance being 2.5 million light years.
For calculations accounting for the actual shape of galaxies, see The Calculations of Gravity Fields and Rotation Curves of Whirlpool Galaxies and Dark Material.