According to a new theoretical study, when our solar system was born 4.6 billion years ago only 8% of the potentially habitable planets that will ever form in the universe existed. And, the party won't be over when the sun burns out in another 6 billion years. The bulk of those planets -- 92% -- have yet to be born. This conclusion is based on an assessment of data collected by NASA's Hubble Space Telescope and the prolific planet-hunting Kepler space observatory. http://www.geologypage.com/2015/10/most-earth-like-worlds-have-yet-to-be.html
From there being lots of leftover hydrogen and helium at the present. More seriously, there are complications, like galaxies merging and forming giant elliptical galaxies. Many of that kind of galaxy are short on interstellar gas and dust -- it got spewed out. Also, material getting sequestered in white dwarfs and neutron stars and black holes. A more careful calculation will have to take into account those sinks of raw materials for stars and planets, though the authors may already have done at least some of that. On the history and future of cosmic planet formation Abstract: