In the simplest models of lattice, the repulsive potential is considered to drop much faster than the attractive one so the repulsive effects are considered only between the nearest neighbors in the calculations of the total energy. This is how it is done is some introductory solid-state books, like Kittel's.