In this paper we define a surface dielectric function for a semi-infinite electron system and a sum rule involving the imaginary part of the inverse of the surface dielectric function is derived. The sum rule has almost exactly the same form as the well-known dielectric function f-sum rule in a bulk system, with the bulk quantities replaced by the corresponding surface quantities. However there is an important difference that the surface sum rule applies to all surfaces only in the Q - 0 limit, where Q is the two-dimensional wavevector parallel to the surface. For small Q, linear and higher order terms of Q will appear in the sum rule whose coefficients may depend on the surface properties of the system considered. This is due to the fact that for Q = 0 both the surface dielectric function and the surface plasma frequency depend on the average electron density only, independent of the surface properties; however for Q # 0; the Q-dependence of the above two quantities both depend sensitively on the surface properties of the system considered.