Both plasmon excitations and interband transitions are important in the response of valence bands to fast electrons. An extended Drude dielectric function was established to describe such a response in solids of complex band structures. Parameters in this function were determined by a fit of the imaginary part of the function to experimental optical data. The real part of the dielectric function and the energy-loss function were also checked with experimental data to confirm critical-point energies in the interband transitions and plasmon energies in the collective excitations. In addition, sum-rules about the imaginary part of the dielectric function and the energy-loss function, respectively, were applied to assure the accuracy of these functions. Electron inelastic mean free paths in several solids were calculated and compared to available experimental and theoretical data.