What is the formula to figure out how far away a star is? I have tried to search for this but it won't show me the formula or "how to" figure out the formula. So what is the formula, and how do you figure it out?

(The formula for stars within 400 light years.)
There is no single formula that tells you how far away a star is. In general, it is difficult to find the exact distance to a star just using its brightness since the brightness of stars vary. 

For close stars parallax is used to accurately tell the distance to the star. For stars farther away more complex ways of finding the distance to the star must be used based on how far away the star is, these methods make up the cosmic distance ladder.