Margin of safety is the gap between a stock's estimated value and its market price, usually expressed as (value − price) / value. A positive margin means the stock trades below your estimate of what it is worth. This 2017 analysis uses book value per share as a simple value estimate: in Excel, pull historical book value with MarketXLS =hf_Book_Value_per_Share("MSFT","2016") and the current price with =Last("MSFT"), divide book value by price, and sort a list of stocks (here the S&P 500) by that ratio to find names trading near or below book value. Book value is a rough proxy for value, so treat results as candidates for research, not recommendations.
Try it in your own spreadsheet
Get the free MarketXLS sample workbook (.xlsx).
No account needed. MarketXLS live data requires a paid plan. Preview workbook
Explore more videos
Margin of safety analysis of stocks
**Key Concepts **Before we get down to the analysis, let us understand the key concepts we will use to perform this margin of safety analysis.
1.** Book value per share:If you assume that a company liquidates as on today, then what will be the value of one share. That means if you are a shareholder of the company and you own one share how much money you will get if the company shuts down today. So as the name suggests, this is the value of your share as per the books of the company. 2. Margin of safety:** The margin of safety is the amount by which a stock's estimated value exceeds its market price. Let us assume that the book value per share of a company is $10, but the market price of one share is $20. Using book value as the value estimate, the margin of safety is negative: the price is $10 above book value. Remember that the market price of a share may not always represent the value of that share. So in this scenario, even though we know for a fact that the value of one share of this company is $10 but still the market price of one share of the company’s $20. So, we may conclude that the market price is higher than the value of that share. Which means that the stock is possibly overvalued by the market.
What we want to do with our analysis is find out, if there are some stocks where book value is higher than the market price. And also look to establish a relationship between the book value and the market price by looking into the historical data of some stocks. This analysis will make us more confident when we actually make our decision to recommend or buy an undervalued stock with this approach.
Using MarketXLS FormulasMarketXLS has inbuilt functions to get the historical book value per share and also to get the historical close prices of the stocks. Below is the syntax that we will use to get these values.
This function will get the book value per share of any symbol in the history.
This function will get the historical close price of any symbol in the history on a specific date.
And this function will get the last price of the stock. The last price in the current price at which this stock is trading. Analyze one stockSo before we do this analysis for the whole of the S&P 500, let’s value one stock. As you can see below I have collected the book value and the price of Microsoft in 2016. Now you may wonder what price point we will take as a representative of the whole year of close prices. For this analysis, we have taken the close price at the last trading day of a year.

book value per share
So the value $9.08 the is the book value of Microsoft and the period ending 2016 and the price $62.14 is the close price on the last day of trading in 2016.
Here the price is well above book value, so there is no margin of safety on a book value basis. A large premium to book value means the market values the company for more than its net assets, for example its earnings power or growth. However, as we understood earlier markets may not represent the real value of the stocks at all the time.
So, what if the market price of the stock is exactly same as its book value? In that case, we may say that the stock price is fairly valued by the market.
Now let’s look at the situation as on July 7, 2017. Instead of looking at each number we can calculate the ratio of the book value to the last price. This ratio shows the book value as a percentage of the stock price.
When this ratio is 100% it means that the stock is fairly priced by the market and the sentiments do not play a big role in the price. In other words, the price is based on facts and not the opinion of the traders and speculators. When this value is 0% it means, that in reality there is no value in this company but still the market is assigning a value to it. ** Screen the whole market for margin of safety analysis of stocks**So now we will do this margin of safety analysis of stocks for the whole of S&P 500 and find out the ratio of the book value to the stock price. So, we calculate the ratio and then sort the table in descending order of the ratio.
After doing this analysis we find a few stocks in S&P 500 which seems to be undervalued by the market. This analysis definitely provides us with some good candidates for further exploration.** Validations with historical data of multiple stocks**
In an ideal world, the more the book value the more should be the share price. And if the book value per share of the stock is growing over the years its price should also increase. That means the book value per share will normally have or should have a direct relationship with the price of the share.
I have charted below the relationship between the book value and the price of various stocks to validate this.
When looking at the book value and the price with the time perspective, we can now some very interesting observations. For example, in the case of Blackberry, market initially started to be very optimistic about the company. But as the years passed the price settled near the Book Value.
In all these charts you would notice that the orange line is above the blue line. So, the price is mostly above the book value per share. But in the interesting case of GNW (Genworth Financial, Inc. (NYSE)) the book value is higher than the current trading price. So, we should look at this for our further analysis in our conquest of finding undervalued stocks.
Perform margin of safety analysis of stocks with MarketXLS with 1,000+ stock market formulas.

