To tell if a stock is overvalued or undervalued, you need to know the value of the company's assets and compare that number to its market price. If the market price is higher than the asset value, then the stock is overpriced and you should sell it. If it's lower, then you can buy it because it's undervalued.
You want to make sure that your calculation doesn't include any intangible assets like goodwill or patents. Those aren't actual assets and shouldn't be included when calculating how much money a company is worth.
You can also use this method to determine whether or not an investment has been successful; if you bought shares in a company at $10 per share and they're now trading at $20 per share, then you've made money.