Valence electron is the generally the electron which is associated with an atom that can participate in the formation of chemical bond. For simple molecules, it is the outer most electron shell.
Looking at the periodic table, the group number can be regarded as the valence electron for each atom. Let me show you an example:
Hydrogen = 1
Helium = 2
Lithium = 3
Oxygen = 6
Beryllium, being in the second group under the alkali earth metals, its valence electrons is 2. Generally, two electrons of Beryllium atom can participate in the chemical reaction.
Be - Beryllium - Atomic # 4 - electrons: 4 - Protons: 4
If you take a look at the periodic table, you will see that Be is in the second column. This means that it has two valence electrons. If you were to move to the next column the valence electrons for each of the elements would be 3.