Absorption-line spectroscopy is a powerful technique to characterize the properties of the ISM, from local environments out to small and possibly starforming galaxies at high z. In particular, we can determine metal abundances, metallicity, dust content, dust-to-metal ratio, nucleosynthesis signatures, kinematics in the ISM of these galaxies. However, the presence of dust dramatically changes the observed metal abundances, a phenomenon called dust depletion. I will present a novel way of taking dust depletion into account and thereby characterize the metallicity and nucleosynthesis signatures in high-z systems (as traced by GRB and QSO absorbers) as well as in the neutral ISM in the Galaxy. This can be also used to investigate the cosmic evolution of the dust and metal content in galaxies.