Variation of valence in a group as well as across a period in the periodic table occurs as follows:
(i) In a group: All elements in a group show the same valency. For example, all alkali metals (group 1) show a valency of +1. Alkaline earth metals, (group 2) show a valency of +2.
However, the heavier elements of p-block elements (except noble gases) show two valence:
one equal to the number of valence electrons or 8 - No. of valence electrons and the other two less. For example, thallium (TI) belongs to group 13. It shows valence of +3 and +1.
Lead (Pb) belongs to group 14. It shows valance of +4 and +2. Antimony (Sb) and Bismuth (Bi) belong to group 15. They show valence of +5 and +3 being more stable. This happens due to the non-participation of the two s-electrons present in the valence shell of these elements. This non-participation of one pair of s-electrons in bonding is called inert-pair effect.
(ii) In a period : The number of the valence electrons increases in going from left to right in a period of the periodic table. Therefore, the valency of the elements in a period first increases and then decreases.