The distribution of local charge excesses (DLC) in metallic alloys, previously obtained as a result of the analysis of order N electronic structure calculations, is derived from a variational principle. A phenomenological Charge Excess Functional (CEF) theory is obtained which is determined by three concentration dependent, material specific, parameters that can be obtained from {it ab initio} calculations. The theory requires modest computational efforts and reproduces with an excellent accuracy the DLC and the electrostatic energies of ordered, substitutionally disordered or segregating metallic alloys and, hence, can be considered an efficient approach alternative to conventional electronic structure calculations. The substantial reduction of computing time opens new perspectives for the understanding of metallic systems and their mechanical properties.