We propose an improved method for calculating electron inelastic mean free paths (IMFPs) in solids from experimental energy-loss functions based on the Mermin dielectric function. The "extended Mermin" method employs a nonlimited number of Mermin oscillators and allows negative oscillators to take into account not only electronic transitions, as is common in the traditional approaches, but also infrared transitions and inner shell electron excitations. The use of only Mermin oscillators naturally preserves two important sum rules when extending to infinite momentum transfer. Excellent agreement is found between calculated IMFPs for Cu and experimental measurements from elastic peak electron spectroscopy. Notably improved fits to the IMFPs derived from analyses of x-ray absorption fine structure measurements for Cu and Mo illustrate the importance of the contribution of infrared transitions in IMFP calculations at low energies.