Valency is the combining capacity of an element.
For a non-metal
valency= 8 - Valency electron.(no. of electrons in the outermost shell of the atom.
For example: Valency of Oxygen is 2 that is
If Oxygen gets two more electons then is gains stability ie. forms its octet.
Some transition metals have variable valency.
But generally valency of metal=valence electrons
ex: sodiun(Na) has a valency of 1 ie. If it loses it one electron it gains stability.