The formula for the market cap is shares outstanding * share price. However, sometimes I see people only taking into account the shares that are publicly traded on the exchange when calculating market cap. So a company with 100,000 shares of which 20% is publicly traded at 100 dollars would have a market cap of 2,000,000 dollars; whereas a company with 100,000 shares of which 50% are publicly traded at 100 dollars would have a market cap of 5,000,000 dollars. Is this the wrong way of calculating the market cap?
Depends on what you want to do with the market cap.
If you want to know how big a particular company is, of course you should be using the full amount of shares.
If you, on the other hand, want to create an index fund, you probably want to include only the shares publicly traded in the weight calculation.
It is very important to know what number for shares outstanding you are using. Let's say there is a hypothetical electricity company that creates 50 TWh / a and has 800 million shares outstanding, out of which 400 million are publicly traded. Let's also say you use 10000 kWh / a of electricity. The correct amount of shares to own to cover your electricity usage is 160:
10000e3/50e12*800e6 = 160
Incorrect calculation would be
10000e3/50e12*400e6 = 80