Ok, here's what I saw somewhere a while ago in relation to tank sized (bear in mind that 1 US Gallon is actually smaller in volume than 1 UK Gallon).
"For a standard rectangular or square tank, multiply H x W x L (in any order) to get total square inches. Then divide the total square inches by 231 to get the (US)gallons. Divide by 277.42 to get (UK)gallons."
Seems to be a pretty accurate formula from what I've checked personally.