I created a computer program to analyze the stock market. I need to calculate the average PE ratio of each stock market sectors, e.g Health Care, Energy, Utilities.

However, many companies listed have a negative earnings thus a negative PE ratio. I want to know if I should include these negative values while calculating the average PE ratio.

Please advise.

  • 1
    It's your analysis. Only you know (unless you elaborate on your analysis) which data you need (and thus, if you want to include negative values). E.g.: what shall happen if a sector has 99% companies with negative PE, what value would describe that sector best for your analysis?
    – Solarflare
    Nov 12, 2023 at 13:38
  • It is a valid question, not sure why the downvote. For inspiration, look at how 'average' PE ratios for stock indices (or ETFs on these indices) are calculated. You need to deal with negative profits but also with (exceptionally) very small profits. They result in extremely high PE ratios (often these are capped). Of course, you need to be transparent in what you are doing and not call it 'average'. Dec 1, 2023 at 16:03

3 Answers 3


It makes no sense to average together positive and negative P/E ratios. As earnings decrease smoothly, the P/E ratio approaches positive infinity, then experiences a discontinuity (jump) to negative infinity, then increases again toward zero.

To illustrate the absurdity of using arithmetic mean: Two companies with P/E of 35 and one with P/E of -10 would have an averaged P/E of 20, which is better than any single input. That's worse than useless for analysis.

Even for strictly positive P/E values, the inherent non-linearity makes an arithmetic mean a poor statistic.

Instead, you should average the yield: E/P, which may be computed either as 1/(P/E) or by dividing earnings per share by share price. Flip it back to P/E ratio after averaging.



If you start picking only values you like, it isn't an average; it's an average of the subset you picked.

If you have a good reason for wanting the latter, fine; label it appropriately rather than just calling it an average, and never forget that it is not representative of the original dataset.


I would - because you're thinking about treating an entire sector as one company with one price and one "Net Income". so you would use the weighted totals of both, including negative numbers.

Let's take a simple scenario - you have 2 equally weighted companies in your scenario, both priced at 100. One has +50 earnings and one has -25. If you treated them as one company, what would the "total" earnings be? I would (I think obviously) say that the total earnings is +25, not +50.

Excluding negative earnings biases the results toward currently profitable companies, and ignores young companies that are not profitable now but are expected to be in the future (otherwise they would not have a positive price).

You can calculate it however you want, you just need to make sure the calculation meets your objectives of using the result.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .