The value of a single share in a company is calculated on the basis of the total amount of shares divided by the market value/cap of the company.
An example might be:
"Whitings" has a market value today at 50 million dollars. The company has a total of 1,000,000 shares. The price for each share is then valued at:
50,000,000$ / 1,000,000 shares = 50$ for each single share.
Here, there are often many beginners who believe and think that it is the price for each share that is unambiguous with whether the share/company is expensive or cheap. You can quickly be tricked into thinking that it is "cheaper" to buy shares in "Whitings 2" priced at 5$ a share than to buy "Whitings" for 50$ a share.
The big mistake many make is as you can see from the calculation below that even if the shares of "Whitings 2" cost 5$ apiece, the market value of the company is 150 million versus "Whitings" with a market value of 50 million. This is because "Whitings 2" has several more shares printed up in the company:
5$ for each share * 3,000,000 shares = 150,000,000$
As you can see, it is always important to look at the market value of a company and not at the price of a single share when evaluating a company based on fundamentals.
It is the market cap that represent the value of the company, not the price per share. Thats why market cap defines whether a share is expensive or cheap, not share price per say.
In the picture below, you can see a image from a financial provider, containing market cap and number (outstanding) of shares. In this case data from the company Tesla:
stock value stocks stock value stocks stock stock value