Well this depends whether you require the moles of gas, solid or solution as to which equation you use, moles relate the mass of the atom of interest to that of the number of atoms in 12 grams of carbon-12. For a solid this is relative to only the ralative molecular mass also know as Mr and the mass of the substance in the equation n = mass/Mr. Whereas for a gas this is related to the things the pressure, the volume and the temperature, due to its greater sensitivity to environmental conditions, as well as the gas constant (R) 8.314 J.K-1.mol-1, combined into the equation PV = nRT. Whereas for a solution the number of moles is related to only the volume and concentration of the substance, combined into the equation n = Vc/1000.