If by weight you mean mass, which is a common fallacy, the formula for calculating mass in a physics context is:
m= F/a (rearranged from F = m*a, with F being the force, a being the acceleration and m being the mass.)
Also, mass can be derived from m = V/D (where V is the volume and D is the density of the material which the object is made from)
But if you mean weight as in "physics" weight, expressed in newtons,
w = m*g (where w is the weight, m is the mass and g is the gravitational force exerted on the object in question by, say a planet, planetoid, or another astrological body; on Earth g is 9.8 and in deep space g is 0, hence the phenomenon, weightlessness).