for example fluorine is a non metal atom.its atomic number is 9.its electronic configuration is 2,7.so here the no. of valence electrons is 7.to find the valency for fluorine atom or any other atom which is 5 or more than 5,just subtract the number from 8.
sodium-atomic number=11 electronic configuration is 2,8,1
here valence electrons is 1.valency is 1.bcz,the valency does not exceed 5