Consider a selfadjoint unbounded operator D on a Hilbert space H and a one parameter norm continuous family of selfadjoint bounded operators that converges in norm to asymptotes at ±∞. Then under certain conditions  that include the assumption that the operators all have discrete spectrum the spectral flow along the path can be shown to be equal to the index of when the latter is an unbounded Fredholm operator on. In  an investigation of the index = spectral flow question when the operators in the path may have some essential spectrum was started but under restrictive assumptions that rule out differential operators in general. In  the question of what happens when the Fredholm condition is dropped altogether was investigated. In these circumstances the Fredholm index is replaced by the Witten index.
In this paper we take the investigation begun in  much further. We show how to generalize a formula known from the setting of the index theorem to the non-Fredholm setting. Restricting back to the case of selfadjoint Fredholm operators our formula extends the result of  in the sense of relaxing the discrete spectrum condition. It also generalizes some other Fredholm operator results of [21,16,11] that permit essential spectrum for the operators in the path. Our result may also apply however when the operators have essential spectrum equal to the whole real line.
Our main theorem gives a trace formula relating the homological index of  to an integral formula that is known, for a path of selfadjoint Fredholms with compact resolvent and with unitarily equivalent endpoints, to compute spectral flow. Our formula however, applies to paths of selfadjoint non-Fredholm operators. We interpret this as indicating there is a generalization of spectral flow to the non-Fredholm setting.