#Javascript ES6 354 bytes p=e=>+'1H2He1LiBeBC1N1O2FNe1Na-Mg1Al-Si1PS2Cl2KAr--Ca3Sc1Ti1VCr1Mn-Fe1Co--Ni3Cu-Zn3Ga1GeAs2Se-Br2Kr-Rb1Sr-Y1ZrNb1MoTc1RuRh1PdAg2Cd1In2Sn1Sb3ITe1XeCs2BaLa-Ce-Pr1Nd-Pm3SmEu3GdTb2DyHoErTm2YbLu1Hf1Ta1W1Re2OsIr1PtAu2Hg1Tl1PbBi--Po-At19Rn-Fr1Ra-Ac2Pa-Th3Np-U4Am-Pu1Cm--Bk2Cf-Es1Fm'.split(RegExp(e+'[^a-z].*'))[0].split('').reduce((o,n)=>+n?+n+o:n=='-'?--o:++o) Ungolfed: function p(e) { return "1H2He1LiBeBC1N1O2FNe1Na-Mg1Al-Si1PS2Cl2KAr--Ca3Sc1Ti1VCr1Mn-Fe1Co--Ni3Cu-Zn3Ga1GeAs2Se-Br2Kr-Rb1Sr-Y1ZrNb1MoTc1RuRh1PdAg2Cd1In2Sn1Sb3ITe1XeCs2BaLa-Ce-Pr1Nd-Pm3SmEu3GdTb2DyHoErTm2YbLu1Hf1Ta1W1Re2OsIr1PtAu2Hg1Tl1PbBi--Po-At19Rn-Fr1Ra-Ac2Pa-Th3Np-U4Am-Pu1Cm--Bk2Cf-Es1Fm" .split(RegExp(e+'[^a-z].*'))[0] .split('') .reduce(function(o,n) { return +n ? +n+o : n=='-' ? --o : ++o; }) } The elements are stored in a string of numbers symbols and minus characters. The mass of any given element is the number of letter characters preceding it, plus the sum of digits subtracted by the occurrences of `-`.