The electron which are acquired to compete the shell or to make the atom stable is called valency.
For ex:- Nitrogen :atomic no is 7 and electronic configuration is 2,5.
hence it needs 3electrons to make the shell stable. so its valency is minus 3.
2. boron :- atomic no. is 5 it's electronic configuration is 2,3. It can lose 3 three electrons instead of gaining 5 electrons . so its valency is plus 3.