Not sure if this helps but I had to design a wardrobe like this recently and did the calculations bottom-up. We were having hanging rails for clothes beneath the shelf. So we worked out what was the highest that rail could be so that my wife (who is shorter than me) could still comfortably reach the clothes/hangers. I then added a couple of inches above that to be able to lift the hangers on and off the rail. I then put the bottom of the hat shelf at that height.