New analytical solutions for chemical evolution models: characterizing the population of star-forming and passive galaxies