Oh well, for a rough idea, look up the Stanford Torus project. They did detailed costings, that's back in the 1970s, also gave the number of residents.
For a 10,000 resident settlement - you need to assume that they are doing something productive there that pays for their cost of assembly eventually or there is no point in doing it financially. So they assumed in the 1970s that they would be building solar satellites in space and beaming cheap electricity back to Earth.
So, this is in 1970s dollars:
So what matters is the maximum debt during construction, here, getting on for 30 billion dollars, for 10,000 people. So about three million dollars per person in 1975 dollars. That's about ten million dollars per person in 2014 dollars.
So for 7 billion people, you are talking about a cost of around 700 trillion dollars. Or maybe 350 trillion dollars as they build a second colony 30 years into the project. That's about five times the Gross world product for what it is worth, to build colonies like that for everyone - though I don't know if it is meaningful to compare the two :).
The problem with this calculation though - that's okay for 10,000 or 20,000 people. But if you have millions, will they still be able to pay for themselves by exporting electricity to Earth? Will we need so much electricity?
So, it is assuming that they find a way to pay for the construction by exporting something valuable back to Earth to those who remain on the Earth.
Because - even though they assumed most of the mass comes from the Moon, for shielding - that mass cost far less than you'd think because they build a mass driver on the Moon, send a bulldozer there and set it filling the mass driver - and after the overhead of sending the equipment there the rest of the cost of the shielding is minimal.
And it is going to be a very long time, probably, before you can make all the other components in space. You are going to have to buy things from the Earth.
Of course if 3D printing and Von Neumann machines really takes off - that could change everything. But it would change everything on the Earth also - so it wouldn't just make it much easier and cheaper to live in space, it would also solve most of our problems on the Earth also (while also creating new ones of course).
That's in 1970s dollars. I don't know of anyone who has done an equally detailed modern costing.
It might well cost less now. But on the other hand - you probably wouldn't need 10,000 people in space in the first place, with modern technology, would be able to do most of the construction work by automated methods or using telerobots operated from Earth, neither available in the 1970s. Which reduces the price of the electricity for the Earth also Who knows, maybe it would cost a lot less, but only employ a thousand or a few hundred people actually in space for the same amount of electricity.
So, need a more detailed version of course, but gives a very rough first idea.
Also depends how soon you want it to happen. If it really did take off exponentially as in that diagram - surely they would then go on to build more colonies doing other things to export to Earth such as space mining. So that $30 billion might be the entire cost for millions of people, after 40 years. On the other hand though, for it to work, you need something for all those millions of people to do that they can export back to Earth.
Since it is always, surely, going to be harder to build something in space than on the Earth - unless we get truly magical technology where it costs essentially nothing to build a Stanford Torus - it will always cost less to build the same amount of accomodation - even as a Buckminster Fuller "Cloud nine" sphere floating in the sky - than in space.
So - even if they earn enough from their Stanford Torus habitats to build new habitats in space - I would imagine that most of the proceeds would be used back on Earth where you can make better use of it - at least for building houses and growing food etc for the same cost- and only be used in space where needed to expand capacity of the solar power / asteroid mining depending on the needs, mainly, of people on the Earth.
So - I think myself - that for the foreseeable future we'll have less people in space than on the ground, because here on the Earth everything is so much easier, except space mining and solar satellite construction - and only a limited amount of the Earth's population will need to be employed in those two industries.
If you have to build the habitats in space, without paying for the construction by exporting to Earth, presumably it would cost a lot more per person. And if construction gets easier in space, does on Earth also, probably would still cost an order or two of magnitude more or some such to build your house in space.