I asked a physics-inclined friend how much energy it would take to keep this floating city aloft, and his answer surprised me: The formula was right, and it would take zero energy. He said that it would take a lot of energy to get the city up there, but none to keep it there.
You might need some better physics-inclined friends. You're focused on gravitational potential energy, but you're ignoring everything else.
The problem here is that energy is not something that acts on things, it's something that things have which can be transformed (or transferred) by performing work. A Newton's Cradle is a perfect example of this. You lift one ball to give it gravitational potential energy, then let it go. The force of gravity acts on the ball causing it to fall, transforming GP energy into kinetic energy. When the ball strikes one of the motionless balls the force of the collission applies to each ball in the collision (almost) equally, transferring the kinetic energy through the collected balls until the final ball rebounds up. The energy transfer and transformation was the result of the forces acting on the balls.
The only way to stop gravity from turning your GP energy into kinetic energy is to provide some force to balance things out. Since force and energy go hand in hand, you're going to be chewing through the power (work done per unit of time) to produce enough force to counter the force of gravity.
Don't believe me? Reach your hand out straight in front of you at eye level. Now hold it there, as motionless as you can. Touch one fingertip to a wall or something, not enough to support it but just so you can feel if you start to move. Now hold it there. I'll be right back.
You still holding? Starting to feel some muscle fatigue yet? Give it a few minutes.
What you're feeling is a combination of things, but the one we're interested in is the chemical potential energy you've just expended to keep your muscles tight enough to provide the force that acted against gravity attempting to drag you down. (Unless you're reading this on the ISS, in which case you're cheating. And also awesome.) You didn't move, your muscles didn't move much, but you consumed (i.e. transformed into bound chemical energy and heat) some energy just by staying perfectly still, and more than if you didn't have your arm up.
So can we please stop with this idea that "the city doesn't move!" means "we don't have to use energy!"? Please?
When you are generating a force - such as the one you're going to need to counter the force of gravity - you are transforming energy in some way. And because Thermodynamics is still a thing, some of that energy is being lost in forms you didn't want: probably at least heat and sound.
Oh, but wait, we have magic! We don't have to worry about conservation of energy and stuff. That's for the poor sods stuck in physics-dominated universes that don't have access to things like extra-planar portals and so on.
So here's how you do it.
First, enslave a bunch of the inhabitants of the nearby planes. Force them to build towers in the place that matches where you want your city to be, just next door in a suitable plane - I hear the Ethereal is relative stable this millenium. Next, enchant some materials to exist in both the material and Ethereal plane, and place them on top of the towers. Back in the material plane, use those as support girders to build the base plate of your city on. Keep the horde of critters working on expanding the forest of support towers - maybe contract an edritch horror or two to keep them in line while you're busy in the real world.
Now we just need to invite some sucker... I mean citizens to come build our amazing floating city. Oh, and maybe get some fae folk to go pretty up the support towers in the ethereal realm. Just in case someone with True Sight or something comes looking, we want to be able to pass them off as epic spell formations or something.
Now all that gravity trying to tear you from the sky is frustrated because the structure is supported by the bedrock of the ethereal.
Just... don't overdo it. Even bedrock will liquify under enough pressure. And you might want to invest in some heavy duty stabilizers to make sure the Ethereal landscape stays where you put it.