We have determined electron inelastic mean free paths (IMFPs) in C (graphite), Si, Cr, Fe, Cu, Zn, Ga, Mo, Ag, Ta, W, Pt and Au by elastic-peak electron spectroscopy (EPES) using Ni as a reference material for electron energies between 50 and 5000 eV. These IMFPs could be fitted by the simple Bethe equation for inelastic electron scattering in matter for energies from 100 to 5000 eV. The average root-mean-square (RMS) deviation in these fits was 9%. The IMFPs for Si, Cr, Fe, Cu, Ag, Ta, W, Pt and Au were in excellent agreement with the corresponding values calculated from optical data for energies between 100 and 5000 eV. While the RMS differences for graphite and Mo in these comparisons were large (27 and 17%, respectively), the average RMS difference for the other 11 elements was 11%. Similar comparisons were made between our IMFPs and values obtained from the TPP-2M predictive equation for energies between 100 and 5000 eV, and the average RMS difference for the 13 solids was 10.7%; in these comparisons, the RMS differences for Ta and W were relatively large (26% for each). A correction for surface-electronic excitations was calculated from a formula of Werner et al.; except for Si and Ga, the average correction was 5% for energies between 150 and 5000 eV. The satisfactory consistency between the IMFPs from our EPES experiments and the corresponding IMFPs computed from optical data indicates that the uncertainty of these IMFPs is about 11% for electron energies between 100 and 5000 eV. Similar comparisons with IMFPs from the EPES experiments of Werner et al. showed a consistency of 8% for energies between 200 and 5000 eV.