If you attach a magnet to a vertical surface, such as a steel plate on a wall or a refrigerator door or a metal cabinet, the magnetic force will be weaker. However, this also depends on other factors. In the case of placing the magnet on a vertical surface, the shearing force also comes into play. It increases or decreases depending on the friction between the magnet and the supporting vertical base. If you attach a shiny, nickel-plated magnet to a polished surface, it will not stick to it as well as if the magnet had an anti-slip surface, such as a rubber coating. Because the layer of rubber on the rubber-coated magnet is slightly thicker than the nickel-plating layer itself, the magnet is further away from the supporting base, and the holding force also changes slightly.
equal lifting force (floor and ceiling)
the surface must be flat for a greater force
the surface must be thick for the magnet to have something to grip onto