An index product formula for the study of elliptic resonance problems