1. Make sure the height is in MILLIMETERS (mm)
2. Once the height is in mm, convert it to ATM.
3. If the gas pressure is more than the pressure outside, then add the given atmospheric pressure to the height.
4. If the gas pressure is less than the pressure outside, then subtract the height from the given atmospheric pressure.
5. If the tube is closed, the pressure of the gas is equal to the height of the mercury column, therefore, just convert to atmospheres and that is your answer.