Valancy of an element is determined by the number of electrons in its outer shell. So, the number of valence electrons obtained from the electronic configuration of the element gives the valency i.e. the number of electrons gained ,lost or shared by the element to attain the noble gas configuration.