The data I could find by searching the web: (Please correct any errors)
Earth's mean radius is about 6,371 Km.
The volume of ice in the polar caps are about $26,500,000 Km^3$, most of which is in the Antarctic. After melting this will become $23,850,000 Km^3$
Earth's surface is about $510,000,000 Km^2$
The current Ocean surface is about $362,100,000 Km^2$ (71% of the surface of the planet)
I do not think the fact that earth is not a perfect sphere makes much of a difference to the result, so we can (probably) work on a sphere for the sake of the calculation.
The ocean surface will increase as the water covers more of the land (and to a lesser degree due to the radius of the sphere increasing with the rising ocean level). Are there any numbers that tell us how much? Can we use some guesses as to the average incline of land in coastal regions? Otherwise if we can get a formula based on an assumption that an average slope (angle) can be found. Failing any real numbers maybe we can work out the worst-case (90-degree incline) and best case (no incline at all) as I do not want to over complicate the formula for no real benefit in accuracy.
Secondly of course the shape of the continents is irregular. Can we ignore the capes and inlets and twists and turns in the coastline? Can we build in a factor for this? How much does it affect the end result? Can we approximate the continents as a number of simple geometric shapes, and would that actually give a more accurate answer than say assuming all land mass is in a single round island with a constant slope? Once again over complicating the formula for no real benefit in accuracy makes no sense.
We can discard the effect of any floating ice since it is already displacing the same amount of water that it would when melted. I don't know what percentage of the total ice this constitutes though, but I assume it is negligible.
This leaves the question of what amount of the WAIS ice and the EAIS ice are in fact above sea level. Since the shelves are resting on the bedrock we know that there is more above sea level than the weight of the water displaced.
Some data about the thickness of the ice shelves are here: http://www.antarcticglaciers.org/antarctica/west-antarctic-ice-sheet/
I have not found answers about the actual average thickness of the ice or the amount of ice above sea level. We may be able to work this out using the volume and surface area of the ice as well as the average height above sea level, but I have not yet found these numbers.
Any ice which is completely below sea level will cause a negative rise in sea level when melting. In fact only the part above the sea which is more than the "10%" by which water expands will contribute towards sea level rise, at 90% of the volume of that part.
The way I see it we have 2 questions to answer:
What volume of ice is available to cause a rise in the sea levels (the part of the ice which is more than the 10% above sea level)
What is the volume of the space that needs to be filled (the result of the shape of the earth causing an increase in volume for every meter we rise above current sea level.
Are there other factors that I forgot about?
How can we construct a formula to to use all the variables in order to get an answer to the question "how much will the ocean level rise if all the ice melted"
We could model the shapes of the continents using geometric shapes to get a more accurate estimate of the rise in level. We could even go so far as to use actual topographic data but I believe a good average will give us an accurate enough result.
Note: This question is purely about satisfying my own curiosity. I have no agenda to prove/disprove global warming. I've seen claims of numbers between 45 and 65m, etc., and I wondered "How did they work that out!" and "Is that number realistic" Are we going to arrive at the same number? Probably not, there are just too many assumptions and guesses. So please save any trolls/flames/discussions on global climate change that doesn't add to finding the answer for an appropriate forum.
Note 2: I realise that an element of this relates to finding the numbers to plug into the formula, rather than to making up the mathematical formula, but I imagine this is the kind of thing that mathematical minds do enjoy.