The last digit of the group number (the unit digit) is the number of valence electrons of the atoms.
So, group 1 elements (alkali metals) have 1 valence electron; gropup 2 elements (alkaline earth metal) have 2 valence electrons; and group 13 elements (to which aluminum belongs) have 3 valence electrons.
The metals form ions lossing their valence electrons, so the ionic charge will be determined in this form:
kind of element group in number of ionic charge
the periodic table valence electrons
alkali metal 1 1 +1
alkaline earth
metal 2 2 +2
aluminum 13 3 +3
The ionic charge of these metals equals the last digit of the group number.